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;
88mod modint;
99mod scc;
1010mod segtree;
11+ #[ allow( clippy:: many_single_char_names) ]
1112mod string;
1213mod twosat;
1314
Original file line number Diff line number Diff line change @@ -67,6 +67,7 @@ impl Threshold for DefaultThreshold {
6767 }
6868}
6969
70+ #[ allow( clippy:: cognitive_complexity) ]
7071fn 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}
You can’t perform that action at this time.
0 commit comments