File tree Expand file tree Collapse file tree 3 files changed +6
-11
lines changed Expand file tree Collapse file tree 3 files changed +6
-11
lines changed Original file line number Diff line number Diff line change @@ -488,7 +488,7 @@ fn format(opt: Opt) -> Result<i32> {
488488 if opt. verbose {
489489 if let Some ( paths) = config_paths. as_ref ( ) {
490490 println ! (
491- "Using rustfmt config files {}" ,
491+ "Using rustfmt config file(s) {}" ,
492492 paths
493493 . into_iter( )
494494 . map( |p| p. display( ) . to_string( ) )
Original file line number Diff line number Diff line change @@ -273,14 +273,10 @@ impl Config {
273273
274274 // List of closest -> most distant rustfmt config from the current directory.
275275 let config_paths: Option < Vec < _ > > = paths. into_iter ( ) . filter ( |p| p. is_some ( ) ) . collect ( ) ;
276- let has_paths = config_paths. as_ref ( ) . and_then ( |paths| {
277- if paths. is_empty ( ) {
278- None
279- } else {
280- Some ( paths. len ( ) )
281- }
282- } ) ;
283- if has_paths. is_some ( ) {
276+ let has_paths = config_paths
277+ . as_ref ( )
278+ . map_or ( false , |paths| !paths. is_empty ( ) ) ;
279+ if has_paths {
284280 return Ok ( config_paths) ;
285281 }
286282
Original file line number Diff line number Diff line change @@ -292,8 +292,7 @@ impl IgnoreList {
292292 p. strip_prefix ( new_rustfmt_toml_path. parent ( ) . unwrap ( ) )
293293 . map ( PathBuf :: from)
294294 } )
295- . filter ( |p| p. is_ok ( ) )
296- . map ( |p| p. unwrap ( ) )
295+ . flatten ( )
297296 . collect ( ) ;
298297
299298 let mut path_set = other. path_set ;
You can’t perform that action at this time.
0 commit comments