File tree Expand file tree Collapse file tree 5 files changed +16
-20
lines changed
Expand file tree Collapse file tree 5 files changed +16
-20
lines changed Original file line number Diff line number Diff line change 1+ https://rust-lang.org
Original file line number Diff line number Diff line change 1- https://wikipedia .org
1+ https://rust-lang .org
Original file line number Diff line number Diff line change @@ -685,23 +685,19 @@ mod cli {
685685 . arg ( "--hidden" )
686686 . assert ( )
687687 . success ( )
688- . stdout ( contains ( "1 Total" ) ) ;
688+ . stdout ( contains ( "2 Total" ) ) ;
689689
690- cargo_bin_cmd ! ( )
690+ let result = cargo_bin_cmd ! ( )
691691 . arg ( "--dump" )
692692 . arg ( "--hidden" )
693693 . arg ( fixtures_path ! ( ) . join ( "hidden/" ) )
694694 . assert ( )
695- . stdout ( contains ( "wikipedia.org" ) )
696695 . success ( ) ;
697696
698- cargo_bin_cmd ! ( )
699- . arg ( "--dump-inputs" )
700- . arg ( "--hidden" )
701- . arg ( fixtures_path ! ( ) . join ( "hidden/" ) )
702- . assert ( )
703- . stdout ( contains ( ".hidden" ) )
704- . success ( ) ;
697+ assert_lines_eq (
698+ result,
699+ vec ! [ "https://rust-lang.org/" , "https://rust-lang.org/" ] ,
700+ ) ;
705701 }
706702
707703 #[ test]
@@ -2058,7 +2054,8 @@ The config file should contain every possible key for documentation purposes."
20582054 . arg ( test_dir)
20592055 . assert ( )
20602056 . success ( )
2061- . stdout ( contains ( ".hidden/file.md" ) ) ;
2057+ . stdout ( contains ( "hidden/.file.md" ) )
2058+ . stdout ( contains ( "hidden/.hidden/file.md" ) ) ;
20622059 }
20632060
20642061 #[ test]
Original file line number Diff line number Diff line change @@ -46,21 +46,19 @@ impl FileExtensions {
4646 pub fn contains < T : Into < String > > ( & self , file_extension : T ) -> bool {
4747 self . 0 . contains ( & file_extension. into ( ) )
4848 }
49- }
50-
51- impl TryFrom < FileExtensions > for Types {
52- type Error = super :: ErrorKind ;
5349
5450 /// Build the current list of file extensions into a file type matcher.
5551 ///
5652 /// # Errors
5753 ///
5854 /// Fails if an extension is `all` or otherwise contains any character that
5955 /// is not a Unicode letter or number.
60- fn try_from ( value : FileExtensions ) -> super :: Result < Self > {
56+ pub fn build ( self , skip_hidden : bool ) -> super :: Result < Types > {
6157 let mut types_builder = TypesBuilder :: new ( ) ;
62- for ext in value. 0 . clone ( ) {
63- types_builder. add ( & ext, & format ! ( "*.{ext}" ) ) ?;
58+ let prefix = if skip_hidden { "[!.]" } else { "" } ;
59+
60+ for ext in self . 0 {
61+ types_builder. add ( & ext, & format ! ( "{prefix}*.{ext}" ) ) ?;
6462 }
6563 Ok ( types_builder. select ( "all" ) . build ( ) ?)
6664 }
Original file line number Diff line number Diff line change @@ -88,7 +88,7 @@ impl InputResolver {
8888 // Ignore hidden files if necessary
8989 . hidden ( skip_hidden)
9090 // Configure the file types filter to only include files with matching extensions
91- . types ( file_extensions. try_into ( ) ?)
91+ . types ( file_extensions. build ( skip_hidden ) ?)
9292 . build ( ) )
9393 }
9494
You can’t perform that action at this time.
0 commit comments