Skip to content

Commit

Permalink
Merge pull request #113 from mizar/work_clippy
Browse files Browse the repository at this point in the history
Work clippy
  • Loading branch information
qryxip authored Jan 21, 2023
2 parents 307574c + a62e93b commit 0b92413
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/maxflow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ where
assert!(Cap::zero() <= cap);
let m = self.pos.len();
self.pos.push((from, self.g[from].len()));
let rev = self.g[to].len() + if from == to { 1 } else { 0 };
let rev = self.g[to].len() + usize::from(from == to);
self.g[from].push(_Edge { to, rev, cap });
let rev = self.g[from].len() - 1;
self.g[to].push(_Edge {
Expand Down
14 changes: 4 additions & 10 deletions src/string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,8 @@ fn sa_doubling(s: &[i32]) -> Vec<usize> {
sa.sort_by(cmp);
tmp[sa[0]] = 0;
for i in 1..n {
tmp[sa[i]] = tmp[sa[i - 1]]
+ if cmp(&sa[i - 1], &sa[i]) == std::cmp::Ordering::Less {
1
} else {
0
};
tmp[sa[i]] =
tmp[sa[i - 1]] + i32::from(cmp(&sa[i - 1], &sa[i]) == std::cmp::Ordering::Less);
}
std::mem::swap(&mut tmp, &mut rnk);
k *= 2;
Expand Down Expand Up @@ -253,11 +249,9 @@ pub fn lcp_array_arbitrary<T: Ord>(s: &[T], sa: &[usize]) -> Vec<usize> {
rnk[sa[i]] = i;
}
let mut lcp = vec![0; n - 1];
let mut h = 0;
let mut h: usize = 0;
for i in 0..n - 1 {
if h > 0 {
h -= 1;
}
h = h.saturating_sub(1);
if rnk[i] == 0 {
continue;
}
Expand Down

0 comments on commit 0b92413

Please sign in to comment.