@@ -14,6 +14,7 @@ use syntax::source_map::{FilePathMapping, SourceMap, Span, DUMMY_SP};
14
14
15
15
use crate :: comment:: { CharClasses , FullCodeCharKind } ;
16
16
use crate :: config:: { Config , FileName , Verbosity } ;
17
+ use crate :: ignore_path:: IgnorePathSet ;
17
18
use crate :: issues:: BadIssueSeeker ;
18
19
use crate :: utils:: { count_newlines, get_skip_macro_names} ;
19
20
use crate :: visitor:: { FmtVisitor , SnippetProvider } ;
@@ -90,6 +91,10 @@ fn format_project<T: FormatHandler>(
90
91
parse_session. span_diagnostic = Handler :: with_emitter ( true , None , silent_emitter) ;
91
92
92
93
let mut context = FormatContext :: new ( & krate, report, parse_session, config, handler) ;
94
+ let ignore_path_set = match IgnorePathSet :: from_ignore_list ( & config. ignore ( ) ) {
95
+ Ok ( set) => set,
96
+ Err ( e) => return Err ( ErrorKind :: InvalidGlobPattern ( e) ) ,
97
+ } ;
93
98
94
99
let files = modules:: ModResolver :: new (
95
100
context. parse_session . source_map ( ) ,
@@ -99,7 +104,8 @@ fn format_project<T: FormatHandler>(
99
104
. visit_crate ( & krate)
100
105
. map_err ( |e| io:: Error :: new ( io:: ErrorKind :: Other , e) ) ?;
101
106
for ( path, ( module, _) ) in files {
102
- if ( config. skip_children ( ) && path != main_file) || config. ignore ( ) . skip_file ( & path) {
107
+ let should_ignore = !input_is_stdin && ignore_path_set. is_match ( & path) ;
108
+ if ( config. skip_children ( ) && path != main_file) || should_ignore {
103
109
continue ;
104
110
}
105
111
should_emit_verbose ( input_is_stdin, config, || println ! ( "Formatting {}" , path) ) ;
@@ -276,7 +282,10 @@ impl FormattingError {
276
282
| ErrorKind :: IoError ( _)
277
283
| ErrorKind :: ParseError
278
284
| ErrorKind :: LostComment => "internal error:" ,
279
- ErrorKind :: LicenseCheck | ErrorKind :: BadAttr | ErrorKind :: VersionMismatch => "error:" ,
285
+ ErrorKind :: LicenseCheck
286
+ | ErrorKind :: BadAttr
287
+ | ErrorKind :: InvalidGlobPattern ( ..)
288
+ | ErrorKind :: VersionMismatch => "error:" ,
280
289
ErrorKind :: BadIssue ( _) | ErrorKind :: DeprecatedAttr => "warning:" ,
281
290
}
282
291
}
0 commit comments