@@ -90,7 +90,7 @@ pub fn diff_filter_file(
9090
9191/// Filter a list of mutants to those intersecting a diff on the file tree.
9292pub fn diff_filter ( mutants : Vec < Mutant > , diff_text : & str ) -> Result < Vec < Mutant > , DiffFilterError > {
93- let patches = match flickzeug:: patch_from_str ( & diff_text) {
93+ let patches = match flickzeug:: patch_from_str ( diff_text) {
9494 Ok ( patches) => patches,
9595 Err ( err) => return Err ( DiffFilterError :: InvalidDiff ( err. to_string ( ) ) ) , // squash to a string to simplify lifetimes
9696 } ;
@@ -103,7 +103,7 @@ pub fn diff_filter(mutants: Vec<Mutant>, diff_text: &str) -> Result<Vec<Mutant>,
103103 let mut lines_changed_by_path: HashMap < & Utf8Path , Vec < usize > > = HashMap :: new ( ) ;
104104 let mut changed_rs_file = false ;
105105 for patch in & patches {
106- let path = strip_patch_path ( & patch. modified ( ) . unwrap_or_default ( ) ) ;
106+ let path = strip_patch_path ( patch. modified ( ) . unwrap_or_default ( ) ) ;
107107 if path != "/dev/null" && path. extension ( ) == Some ( "rs" ) {
108108 changed_rs_file = true ;
109109 lines_changed_by_path
@@ -224,7 +224,7 @@ fn affected_lines(diff: &Diff<str>) -> Vec<usize> {
224224 Line :: Insert ( _) | Line :: Context ( _) => {
225225 if prev_removed {
226226 debug_assert ! (
227- affected_lines. last( ) . map_or ( true , |last| * last < lineno) ,
227+ affected_lines. last( ) . is_none_or ( |last| * last < lineno) ,
228228 "{lineno} {affected_lines:?}"
229229 ) ;
230230 debug_assert ! ( lineno >= 1 , "{lineno}" ) ;
@@ -238,7 +238,7 @@ fn affected_lines(diff: &Diff<str>) -> Vec<usize> {
238238 lineno += 1 ;
239239 }
240240 Line :: Insert ( _) => {
241- if affected_lines. last ( ) . map_or ( true , |last| * last != lineno) {
241+ if affected_lines. last ( ) . is_none_or ( |last| * last != lineno) {
242242 affected_lines. push ( lineno) ;
243243 }
244244 lineno += 1 ;
@@ -247,7 +247,7 @@ fn affected_lines(diff: &Diff<str>) -> Vec<usize> {
247247 if lineno > 1
248248 && affected_lines
249249 . last ( )
250- . map_or ( true , |last| * last != ( lineno - 1 ) )
250+ . is_none_or ( |last| * last != ( lineno - 1 ) )
251251 {
252252 affected_lines. push ( lineno - 1 ) ;
253253 }
@@ -352,7 +352,7 @@ index eb42779..a0091b7 100644
352352 assert_eq ! ( err. unwrap_err( ) . exit_code( ) , 0 ) ;
353353 }
354354
355- /// https://github.com/sourcefrog/cargo-mutants/issues/580
355+ /// < https://github.com/sourcefrog/cargo-mutants/issues/580>
356356 #[ test]
357357 fn parse_diff_with_only_moves ( ) {
358358 let diff_str = "\
@@ -380,9 +380,9 @@ rename to test-utils/src/write.rs
380380 // Assert our diff library, Flickzeug, doesn't break on this
381381 let diffs = flickzeug:: patch_from_str ( diff_str) . unwrap ( ) ;
382382 assert_eq ! ( diffs. len( ) , 5 ) ;
383- diffs . iter ( ) . for_each ( | diff| {
383+ for diff in & diffs {
384384 assert_eq ! ( diff. hunks( ) . len( ) , 0 ) ;
385- } ) ;
385+ }
386386 let err = diff_filter ( Vec :: new ( ) , diff_str) ;
387387 assert_eq ! ( err, Err ( DiffFilterError :: NoMutants ) ) ;
388388 }
@@ -397,7 +397,7 @@ Binary files target/release/cargo-mutants and target/debug/cargo-mutants differ
397397 let err = diff_filter ( Vec :: new ( ) , diff_str) ;
398398 assert_matches ! (
399399 err,
400- Err ( DiffFilterError :: EmptyDiff ) | Err ( DiffFilterError :: NoSourceFiles )
400+ Err ( DiffFilterError :: EmptyDiff | DiffFilterError :: NoSourceFiles )
401401 ) ;
402402 }
403403
0 commit comments