File tree 2 files changed +8
-4
lines changed
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 @@ -124,10 +124,7 @@ fn default_handler(
124
124
125
125
impl ParseSess {
126
126
pub ( crate ) fn new ( config : & Config ) -> Result < ParseSess , ErrorKind > {
127
- let ignore_path_set = match IgnorePathSet :: from_ignore_list ( & config. ignore ( ) ) {
128
- Ok ( ignore_path_set) => Lrc :: new ( ignore_path_set) ,
129
- Err ( e) => return Err ( ErrorKind :: InvalidGlobPattern ( e) ) ,
130
- } ;
127
+ let ignore_path_set = Lrc :: new ( IgnorePathSet :: from_ignore_list ( & config. ignore ( ) ) ?) ;
131
128
let source_map = Lrc :: new ( SourceMap :: new ( FilePathMapping :: empty ( ) ) ) ;
132
129
let can_reset_errors = Lrc :: new ( AtomicBool :: new ( false ) ) ;
133
130
You can’t perform that action at this time.
0 commit comments