File tree Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Original file line number Diff line number Diff line change 1
1
use ignore:: { self , gitignore} ;
2
2
3
3
use crate :: config:: { FileName , IgnoreList } ;
4
+ use crate :: ErrorKind ;
4
5
5
6
pub ( crate ) struct IgnorePathSet {
6
7
ignore_set : gitignore:: Gitignore ,
@@ -30,6 +31,12 @@ impl IgnorePathSet {
30
31
}
31
32
}
32
33
34
+ impl From < ignore:: Error > for ErrorKind {
35
+ fn from ( error : ignore:: Error ) -> Self {
36
+ ErrorKind :: InvalidGlobPattern ( error)
37
+ }
38
+ }
39
+
33
40
#[ cfg( test) ]
34
41
mod test {
35
42
use rustfmt_config_proc_macro:: nightly_only_test;
Original file line number Diff line number Diff line change @@ -142,10 +142,7 @@ fn default_handler(
142
142
143
143
impl ParseSess {
144
144
pub ( crate ) fn new ( config : & Config ) -> Result < ParseSess , ErrorKind > {
145
- let ignore_path_set = match IgnorePathSet :: from_ignore_list ( & config. ignore ( ) ) {
146
- Ok ( ignore_path_set) => Lrc :: new ( ignore_path_set) ,
147
- Err ( e) => return Err ( ErrorKind :: InvalidGlobPattern ( e) ) ,
148
- } ;
145
+ let ignore_path_set = Lrc :: new ( IgnorePathSet :: from_ignore_list ( & config. ignore ( ) ) ?) ;
149
146
let source_map = Lrc :: new ( SourceMap :: new ( FilePathMapping :: empty ( ) ) ) ;
150
147
let can_reset_errors = Lrc :: new ( AtomicBool :: new ( false ) ) ;
151
148
You can’t perform that action at this time.
0 commit comments