about summary refs log tree commit diff
diff options
context:
space:
mode:
authorUnknown <dobbybabee@gmail.com>2019-01-18 00:12:35 -0500
committerUnknown <dobbybabee@gmail.com>2019-01-18 00:12:35 -0500
commit38b3a4ec6309429a6ea4acced6dc2d5e1d745622 (patch)
treef33565d7b39f296bc0e7b5251407e1ee1af4acd0
parenta3b3a54e930dec06935af37beae340a8f6a7b4ec (diff)
downloadrust-38b3a4ec6309429a6ea4acced6dc2d5e1d745622.tar.gz
rust-38b3a4ec6309429a6ea4acced6dc2d5e1d745622.zip
Fixing issues pointed out by dogfood tests.
-rw-r--r--tests/missing-test-files.rs27
1 files changed, 12 insertions, 15 deletions
diff --git a/tests/missing-test-files.rs b/tests/missing-test-files.rs
index f79abedc062..558e001d3d1 100644
--- a/tests/missing-test-files.rs
+++ b/tests/missing-test-files.rs
@@ -4,7 +4,7 @@ use std::path::Path;
 #[test]
 fn test_missing_tests() {
     let missing_files = explore_directory(Path::new("./tests"));
-    if missing_files.len() > 0 {
+    if !missing_files.is_empty() {
         assert!(
             false,
             format!(
@@ -31,25 +31,22 @@ fn explore_directory(dir: &Path) -> Vec<String> {
     let mut current_file = String::new();
     let mut files: Vec<DirEntry> = fs::read_dir(dir).unwrap().filter_map(Result::ok).collect();
     files.sort_by_key(|e| e.path());
-    for entry in files.iter() {
+    for entry in &files {
         let path = entry.path();
         if path.is_dir() {
             missing_files.extend(explore_directory(&path));
         } else {
             let file_stem = path.file_stem().unwrap().to_str().unwrap().to_string();
-            match path.extension() {
-                Some(ext) => {
-                    match ext.to_str().unwrap() {
-                        "rs" => current_file = file_stem.clone(),
-                        "stderr" | "stdout" => {
-                            if file_stem != current_file {
-                                missing_files.push(path.to_str().unwrap().to_string());
-                            }
-                        },
-                        _ => continue,
-                    };
-                },
-                None => {},
+            if let Some(ext) = path.extension() {
+                match ext.to_str().unwrap() {
+                    "rs" => current_file = file_stem.clone(),
+                    "stderr" | "stdout" => {
+                        if file_stem != current_file {
+                            missing_files.push(path.to_str().unwrap().to_string());
+                        }
+                    },
+                    _ => continue,
+                };
             }
         }
     }