Skip to content

Commit e87e825

Browse files
committed
Silence clippy warnings
1 parent 72f82b6 commit e87e825

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ mod mincostflow;
88
mod modint;
99
mod scc;
1010
mod segtree;
11+
#[allow(clippy::many_single_char_names)]
1112
mod string;
1213
mod twosat;
1314

src/string.rs

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ impl Threshold for DefaultThreshold {
6767
}
6868
}
6969

70+
#[allow(clippy::cognitive_complexity)]
7071
fn sa_is<T: Threshold>(s: &[usize], upper: usize) -> Vec<usize> {
7172
let n = s.len();
7273
match n {
@@ -175,9 +176,8 @@ fn sa_is<T: Threshold>(s: &[usize], upper: usize) -> Vec<usize> {
175176
let mut r = sorted_lms[i];
176177
let end_l = if lms_map[l] < m { lms[lms_map[l]] } else { n };
177178
let end_r = if lms_map[r] < m { lms[lms_map[r]] } else { n };
178-
let mut same = true;
179-
if end_l - l != end_r - r {
180-
same = false;
179+
let same = if end_l - l != end_r - r {
180+
false
181181
} else {
182182
while l < end_l {
183183
if s[l] != s[r] {
@@ -186,10 +186,8 @@ fn sa_is<T: Threshold>(s: &[usize], upper: usize) -> Vec<usize> {
186186
l += 1;
187187
r += 1;
188188
}
189-
if l == n || s[l] != s[r] {
190-
same = false;
191-
}
192-
}
189+
l != n && s[l] == s[r]
190+
};
193191
if !same {
194192
rec_upper += 1;
195193
}
@@ -202,8 +200,8 @@ fn sa_is<T: Threshold>(s: &[usize], upper: usize) -> Vec<usize> {
202200
}
203201
induce(&mut sa, &mut sorted_lms);
204202
}
205-
for i in 0..n {
206-
sa[i] -= 1;
203+
for elem in sa.iter_mut() {
204+
*elem -= 1;
207205
}
208206
sa
209207
}

0 commit comments

Comments
 (0)