]> git.lizzy.rs Git - rust.git/blobdiff - tests/missing-test-files.rs
add tests for a false negative on `needless_return`
[rust.git] / tests / missing-test-files.rs
index 558e001d3d10bdacbfc7349220786aa5bb1a057d..9cef7438d225cbc51cdedd1b471ece46bbb89e78 100644 (file)
@@ -1,3 +1,5 @@
+#![allow(clippy::assertions_on_constants)]
+
 use std::fs::{self, DirEntry};
 use std::path::Path;
 
@@ -7,14 +9,12 @@ fn test_missing_tests() {
     if !missing_files.is_empty() {
         assert!(
             false,
-            format!(
-                "Didn't see a test file for the following files:\n\n{}\n",
-                missing_files
-                    .iter()
-                    .map(|s| format!("\t{}", s))
-                    .collect::<Vec<_>>()
-                    .join("\n")
-            )
+            "Didn't see a test file for the following files:\n\n{}\n",
+            missing_files
+                .iter()
+                .map(|s| format!("\t{}", s))
+                .collect::<Vec<_>>()
+                .join("\n")
         );
     }
 }
@@ -30,7 +30,7 @@ fn explore_directory(dir: &Path) -> Vec<String> {
     let mut missing_files: Vec<String> = Vec::new();
     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());
+    files.sort_by_key(std::fs::DirEntry::path);
     for entry in &files {
         let path = entry.path();
         if path.is_dir() {