File tree 1 file changed +7
-7
lines changed
1 file changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -686,18 +686,18 @@ fn infer_any(entry: &DirEntry) -> Option<(String, PathBuf)> {
686
686
687
687
fn infer_file ( entry : & DirEntry ) -> Option < ( String , PathBuf ) > {
688
688
let path = entry. path ( ) ;
689
- path. file_stem ( )
690
- . and_then ( |p| p. to_str ( ) )
691
- . map ( |p| ( p. to_owned ( ) , path. clone ( ) ) )
689
+ let stem = path. file_stem ( ) ?. to_str ( ) ?. to_owned ( ) ;
690
+ Some ( ( stem, path) )
692
691
}
693
692
694
693
fn infer_subdirectory ( entry : & DirEntry ) -> Option < ( String , PathBuf ) > {
695
694
let path = entry. path ( ) ;
696
695
let main = path. join ( "main.rs" ) ;
697
- let name = path. file_name ( ) . and_then ( |n| n. to_str ( ) ) ;
698
- match ( name, main. exists ( ) ) {
699
- ( Some ( name) , true ) => Some ( ( name. to_owned ( ) , main) ) ,
700
- _ => None ,
696
+ let name = path. file_name ( ) ?. to_str ( ) ?. to_owned ( ) ;
697
+ if main. exists ( ) {
698
+ Some ( ( name, main) )
699
+ } else {
700
+ None
701
701
}
702
702
}
703
703
You can’t perform that action at this time.
0 commit comments