@@ -124,8 +124,8 @@ impl HiArgs {
124124
125125 // We modify the mode in-place on `low` so that subsequent conversions
126126 // see the correct mode.
127- match low. mode {
128- Mode :: Search ( ref mut mode ) => match * mode {
127+ if let Mode :: Search ( ref mut mode ) = low. mode {
128+ match * mode {
129129 // treat `-v --count-matches` as `-v --count`
130130 SearchMode :: CountMatches if low. invert_match => {
131131 * mode = SearchMode :: Count ;
@@ -135,8 +135,7 @@ impl HiArgs {
135135 * mode = SearchMode :: CountMatches ;
136136 }
137137 _ => { }
138- } ,
139- _ => { }
138+ }
140139 }
141140
142141 let mut state = State :: new ( ) ?;
@@ -175,7 +174,7 @@ impl HiArgs {
175174 log:: debug!( "using {threads} thread(s)" ) ;
176175 let with_filename = low
177176 . with_filename
178- . unwrap_or_else ( || low. vimgrep || !paths. is_one_file ) ;
177+ . unwrap_or ( low. vimgrep || !paths. is_one_file ) ;
179178
180179 let file_separator = match low. mode {
181180 Mode :: Search ( SearchMode :: Standard ) => {
@@ -206,8 +205,8 @@ impl HiArgs {
206205 SearchMode :: FilesWithMatches
207206 | SearchMode :: FilesWithoutMatch
208207 | SearchMode :: Count
209- | SearchMode :: CountMatches => return false ,
210- SearchMode :: JSON => return true ,
208+ | SearchMode :: CountMatches => false ,
209+ SearchMode :: JSON => true ,
211210 SearchMode :: Standard => {
212211 // A few things can imply counting line numbers. In
213212 // particular, we generally want to show line numbers by
@@ -543,7 +542,7 @@ impl HiArgs {
543542 builder
544543 . color_specs ( self . colors . clone ( ) )
545544 . hyperlink ( self . hyperlink_config . clone ( ) )
546- . separator ( self . path_separator . clone ( ) )
545+ . separator ( self . path_separator )
547546 . terminator ( self . path_terminator . unwrap_or ( b'\n' ) ) ;
548547 builder
549548 }
@@ -606,14 +605,14 @@ impl HiArgs {
606605 . max_matches ( self . max_count )
607606 . only_matching ( self . only_matching )
608607 . path ( self . with_filename )
609- . path_terminator ( self . path_terminator . clone ( ) )
608+ . path_terminator ( self . path_terminator )
610609 . per_match_one_line ( true )
611610 . per_match ( self . vimgrep )
612611 . replacement ( self . replace . clone ( ) . map ( |r| r. into ( ) ) )
613612 . separator_context ( self . context_separator . clone ( ) . into_bytes ( ) )
614613 . separator_field_context ( self . field_context_separator . clone ( ) . into_bytes ( ) )
615614 . separator_field_match ( self . field_match_separator . clone ( ) . into_bytes ( ) )
616- . separator_path ( self . path_separator . clone ( ) )
615+ . separator_path ( self . path_separator )
617616 . stats ( self . stats . is_some ( ) )
618617 . trim_ascii ( self . trim ) ;
619618 // When doing multi-threaded searching, the buffer writer is
@@ -642,14 +641,14 @@ impl HiArgs {
642641 . max_matches ( self . max_count )
643642 . only_matching ( self . only_matching )
644643 . path ( self . with_filename )
645- . path_terminator ( self . path_terminator . clone ( ) )
644+ . path_terminator ( self . path_terminator )
646645 . per_match_one_line ( true )
647646 . per_match ( self . vimgrep )
648647 . replacement ( self . replace . clone ( ) . map ( |r| r. into ( ) ) )
649648 . separator_context ( self . context_separator . clone ( ) . into_bytes ( ) )
650649 . separator_field_context ( self . field_context_separator . clone ( ) . into_bytes ( ) )
651650 . separator_field_match ( self . field_match_separator . clone ( ) . into_bytes ( ) )
652- . separator_path ( self . path_separator . clone ( ) )
651+ . separator_path ( self . path_separator )
653652 . stats ( self . stats . is_some ( ) )
654653 . trim_ascii ( self . trim ) ;
655654 // When doing multi-threaded searching, the buffer writer is
@@ -677,9 +676,9 @@ impl HiArgs {
677676 . kind ( kind)
678677 . max_matches ( self . max_count )
679678 . path ( self . with_filename )
680- . path_terminator ( self . path_terminator . clone ( ) )
679+ . path_terminator ( self . path_terminator )
681680 . separator_field ( b":" . to_vec ( ) )
682- . separator_path ( self . path_separator . clone ( ) )
681+ . separator_path ( self . path_separator )
683682 . stats ( self . stats . is_some ( ) )
684683 . build ( wtr)
685684 }
@@ -804,7 +803,7 @@ impl HiArgs {
804803 SortModeKind :: Path if !sort. reverse => return Box :: new ( haystacks) ,
805804 SortModeKind :: Path => {
806805 let mut haystacks = haystacks. collect :: < Vec < Haystack > > ( ) ;
807- haystacks. sort_by ( |ref h1, ref h2| h1. path ( ) . cmp ( h2. path ( ) ) . reverse ( ) ) ;
806+ haystacks. sort_by ( |h1, h2| h1. path ( ) . cmp ( h2. path ( ) ) . reverse ( ) ) ;
808807 return Box :: new ( haystacks. into_iter ( ) ) ;
809808 }
810809 SortModeKind :: LastModified => {
@@ -1242,7 +1241,7 @@ fn globs(state: &State, low: &LowArgs) -> anyhow::Result<ignore::overrides::Over
12421241 // This only enables case insensitivity for subsequent globs.
12431242 builder. case_insensitive ( true ) . unwrap ( ) ;
12441243 for glob in low. iglobs . iter ( ) {
1245- builder. add ( & glob) ?;
1244+ builder. add ( glob) ?;
12461245 }
12471246 Ok ( builder. build ( ) ?)
12481247}
0 commit comments