Skip to content

Commit

Permalink
clippy fix.
Browse files Browse the repository at this point in the history
  • Loading branch information
Narsil committed Oct 5, 2023
1 parent 1bc6d7e commit 4299e52
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 10 deletions.
4 changes: 1 addition & 3 deletions src/esa.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@ fn suffixtree(
h += 1;
}
right[i] = h;
if h > 0 {
h -= 1;
}
h = h.saturating_sub(1);
}

// H = l
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,6 @@ mod rs_tests {
#[test]
fn test_out_of_bounds_bug() {
let string = "banana$band$$";
suffix_rs(&string).unwrap();
suffix_rs(string).unwrap();
}
}
8 changes: 2 additions & 6 deletions src/sais.rs
Original file line number Diff line number Diff line change
Expand Up @@ -291,9 +291,7 @@ fn suffixsort(
if suffix_array[i] != 0 {
suffix_array[ra_index + j] = suffix_array[i] - 1;
// XXX: Bug underflow caught by Rust yeah (well cpp used i32)
if j > 0 {
j -= 1;
}
j = j.saturating_sub(1);
}
}
// XXX: Could call transmute on SA to avoid allocation.
Expand All @@ -318,9 +316,7 @@ fn suffixsort(
} else if c_index != 0 {
suffix_array[ra_index + j] = i + 1;
c_index = 0;
if j > 0 {
j -= 1; /* get p1 */
}
j = j.saturating_sub(1);
}
c1 = c0;
}
Expand Down

0 comments on commit 4299e52

Please sign in to comment.