@@ -99,7 +99,7 @@ pub fn run(options: Options) -> std::io::Result<()> {
9999 let mut needs_conversion = false ;
100100 let code_ranges;
101101 let mut trap_writer = trap:: Writer :: new ( ) ;
102- if path. extension ( ) . map_or ( false , |x| x == "erb" ) {
102+ if path. extension ( ) . is_some_and ( |x| x == "erb" ) {
103103 tracing:: info!( "scanning: {}" , path. display( ) ) ;
104104 extractor:: extract (
105105 & erb,
@@ -371,59 +371,59 @@ fn test_scan_coding_comment() {
371371 assert_eq ! ( result, Some ( "utf-8" . into( ) ) ) ;
372372
373373 let text = "#coding:utf-8" ;
374- let result = scan_coding_comment ( & text. as_bytes ( ) ) ;
374+ let result = scan_coding_comment ( text. as_bytes ( ) ) ;
375375 assert_eq ! ( result, Some ( "utf-8" . into( ) ) ) ;
376376
377377 let text = "# foo\n # encoding: utf-8" ;
378- let result = scan_coding_comment ( & text. as_bytes ( ) ) ;
378+ let result = scan_coding_comment ( text. as_bytes ( ) ) ;
379379 assert_eq ! ( result, None ) ;
380380
381381 let text = "# encoding: latin1 encoding: utf-8" ;
382- let result = scan_coding_comment ( & text. as_bytes ( ) ) ;
382+ let result = scan_coding_comment ( text. as_bytes ( ) ) ;
383383 assert_eq ! ( result, Some ( "latin1" . into( ) ) ) ;
384384
385385 let text = "# encoding: nonsense" ;
386- let result = scan_coding_comment ( & text. as_bytes ( ) ) ;
386+ let result = scan_coding_comment ( text. as_bytes ( ) ) ;
387387 assert_eq ! ( result, Some ( "nonsense" . into( ) ) ) ;
388388
389389 let text = "# coding = utf-8" ;
390- let result = scan_coding_comment ( & text. as_bytes ( ) ) ;
390+ let result = scan_coding_comment ( text. as_bytes ( ) ) ;
391391 assert_eq ! ( result, Some ( "utf-8" . into( ) ) ) ;
392392
393393 let text = "# CODING = utf-8" ;
394- let result = scan_coding_comment ( & text. as_bytes ( ) ) ;
394+ let result = scan_coding_comment ( text. as_bytes ( ) ) ;
395395 assert_eq ! ( result, Some ( "utf-8" . into( ) ) ) ;
396396
397397 let text = "# CoDiNg = utf-8" ;
398- let result = scan_coding_comment ( & text. as_bytes ( ) ) ;
398+ let result = scan_coding_comment ( text. as_bytes ( ) ) ;
399399 assert_eq ! ( result, Some ( "utf-8" . into( ) ) ) ;
400400
401401 let text = "# blah blahblahcoding = utf-8" ;
402- let result = scan_coding_comment ( & text. as_bytes ( ) ) ;
402+ let result = scan_coding_comment ( text. as_bytes ( ) ) ;
403403 assert_eq ! ( result, Some ( "utf-8" . into( ) ) ) ;
404404
405405 // unicode BOM is ignored
406406 let text = "\u{FEFF} # encoding: utf-8" ;
407- let result = scan_coding_comment ( & text. as_bytes ( ) ) ;
407+ let result = scan_coding_comment ( text. as_bytes ( ) ) ;
408408 assert_eq ! ( result, Some ( "utf-8" . into( ) ) ) ;
409409
410410 let text = "\u{FEFF} # encoding: utf-8" ;
411- let result = scan_coding_comment ( & text. as_bytes ( ) ) ;
411+ let result = scan_coding_comment ( text. as_bytes ( ) ) ;
412412 assert_eq ! ( result, Some ( "utf-8" . into( ) ) ) ;
413413
414414 let text = "#! /usr/bin/env ruby\n # encoding: utf-8" ;
415- let result = scan_coding_comment ( & text. as_bytes ( ) ) ;
415+ let result = scan_coding_comment ( text. as_bytes ( ) ) ;
416416 assert_eq ! ( result, Some ( "utf-8" . into( ) ) ) ;
417417
418418 let text = "\u{FEFF} #! /usr/bin/env ruby\n # encoding: utf-8" ;
419- let result = scan_coding_comment ( & text. as_bytes ( ) ) ;
419+ let result = scan_coding_comment ( text. as_bytes ( ) ) ;
420420 assert_eq ! ( result, Some ( "utf-8" . into( ) ) ) ;
421421
422422 // A #! must be the first thing on a line, otherwise it's a normal comment
423423 let text = " #! /usr/bin/env ruby encoding = utf-8" ;
424- let result = scan_coding_comment ( & text. as_bytes ( ) ) ;
424+ let result = scan_coding_comment ( text. as_bytes ( ) ) ;
425425 assert_eq ! ( result, Some ( "utf-8" . into( ) ) ) ;
426426 let text = " #! /usr/bin/env ruby \n # encoding = utf-8" ;
427- let result = scan_coding_comment ( & text. as_bytes ( ) ) ;
427+ let result = scan_coding_comment ( text. as_bytes ( ) ) ;
428428 assert_eq ! ( result, None ) ;
429429}
0 commit comments