File tree Expand file tree Collapse file tree 1 file changed +15
-8
lines changed Expand file tree Collapse file tree 1 file changed +15
-8
lines changed Original file line number Diff line number Diff line change @@ -22,14 +22,21 @@ pub fn check(path: &Path, bad: &mut bool) {
2222 & libcore_path,
2323 & mut |subpath| t ! ( subpath. strip_prefix( & libcore_path) ) . starts_with ( "tests" ) ,
2424 & mut |subpath| {
25- if subpath. ends_with ( ".rs" ) {
26- if t ! ( read_to_string( subpath) ) . contains ( "#[test]" ) {
27- tidy_error ! (
28- bad,
29- "{} contains #[test]; libcore tests must be placed inside \
30- `src/libcore/tests/`",
31- subpath. display( )
32- ) ;
25+ if let Some ( "rs" ) = subpath. extension ( ) . and_then ( |e| e. to_str ( ) ) {
26+ match read_to_string ( subpath) {
27+ Ok ( contents) => {
28+ if contents. contains ( "#[test]" ) {
29+ tidy_error ! (
30+ bad,
31+ "{} contains #[test]; libcore tests must be placed inside \
32+ `src/libcore/tests/`",
33+ subpath. display( )
34+ ) ;
35+ }
36+ }
37+ Err ( err) => {
38+ panic ! ( "failed to read file {:?}: {}" , subpath, err) ;
39+ }
3340 }
3441 }
3542 } ,
You can’t perform that action at this time.
0 commit comments