File tree Expand file tree Collapse file tree 2 files changed +8
-9
lines changed Expand file tree Collapse file tree 2 files changed +8
-9
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ mod mincostflow;
8
8
mod modint;
9
9
mod scc;
10
10
mod segtree;
11
+ #[ allow( clippy:: many_single_char_names) ]
11
12
mod string;
12
13
mod twosat;
13
14
Original file line number Diff line number Diff line change @@ -67,6 +67,7 @@ impl Threshold for DefaultThreshold {
67
67
}
68
68
}
69
69
70
+ #[ allow( clippy:: cognitive_complexity) ]
70
71
fn sa_is < T : Threshold > ( s : & [ usize ] , upper : usize ) -> Vec < usize > {
71
72
let n = s. len ( ) ;
72
73
match n {
@@ -175,9 +176,8 @@ fn sa_is<T: Threshold>(s: &[usize], upper: usize) -> Vec<usize> {
175
176
let mut r = sorted_lms[ i] ;
176
177
let end_l = if lms_map[ l] < m { lms[ lms_map[ l] ] } else { n } ;
177
178
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
181
181
} else {
182
182
while l < end_l {
183
183
if s[ l] != s[ r] {
@@ -186,10 +186,8 @@ fn sa_is<T: Threshold>(s: &[usize], upper: usize) -> Vec<usize> {
186
186
l += 1 ;
187
187
r += 1 ;
188
188
}
189
- if l == n || s[ l] != s[ r] {
190
- same = false ;
191
- }
192
- }
189
+ l != n && s[ l] == s[ r]
190
+ } ;
193
191
if !same {
194
192
rec_upper += 1 ;
195
193
}
@@ -202,8 +200,8 @@ fn sa_is<T: Threshold>(s: &[usize], upper: usize) -> Vec<usize> {
202
200
}
203
201
induce ( & mut sa, & mut sorted_lms) ;
204
202
}
205
- for i in 0 ..n {
206
- sa [ i ] -= 1 ;
203
+ for elem in sa . iter_mut ( ) {
204
+ * elem -= 1 ;
207
205
}
208
206
sa
209
207
}
You can’t perform that action at this time.
0 commit comments