File tree Expand file tree Collapse file tree 1 file changed +7
-15
lines changed Expand file tree Collapse file tree 1 file changed +7
-15
lines changed Original file line number Diff line number Diff line change @@ -931,34 +931,26 @@ where
931
931
Ok ( ( ) )
932
932
}
933
933
934
- /**
935
- Attempts to locate the script specified by the given path. If the path as-given doesn't yield anything, it will try adding file extensions.
936
- */
934
+ /// Attempts to locate the script specified by the given path.
937
935
fn find_script < P > ( path : P ) -> Option < ( PathBuf , fs:: File ) >
938
936
where
939
937
P : AsRef < Path > ,
940
938
{
941
939
let path = path. as_ref ( ) ;
942
940
943
- // Try the path directly.
944
941
if let Ok ( file) = fs:: File :: open ( path) {
945
942
return Some ( ( path. into ( ) , file) ) ;
946
943
}
947
944
948
- // If it had an extension, don't bother trying any others.
949
- if path. extension ( ) . is_some ( ) {
950
- return None ;
951
- }
952
-
953
- // Ok, now try other extensions.
954
- for & ext in & [ "ers" , "rs" ] {
955
- let path = path. with_extension ( ext) ;
956
- if let Ok ( file) = fs:: File :: open ( & path) {
957
- return Some ( ( path, file) ) ;
945
+ if path. extension ( ) . is_none ( ) {
946
+ for & ext in & [ "ers" , "rs" ] {
947
+ let path = path. with_extension ( ext) ;
948
+ if let Ok ( file) = fs:: File :: open ( & path) {
949
+ return Some ( ( path, file) ) ;
950
+ }
958
951
}
959
952
}
960
953
961
- // Welp. ¯\_(ツ)_/¯
962
954
None
963
955
}
964
956
You can’t perform that action at this time.
0 commit comments