about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2021-02-24 13:56:04 +0100
committerMatthias Krüger <matthias.krueger@famsik.de>2021-02-28 02:22:05 +0100
commit53705768824aca634ea6366acd666344611d37e3 (patch)
tree80ea3da0ec14ab44e6268f0459117ce8ff32042a
parentb119b6585959b77017d75149075b22927c452207 (diff)
downloadrust-53705768824aca634ea6366acd666344611d37e3.tar.gz
rust-53705768824aca634ea6366acd666344611d37e3.zip
fix clippy lint warnings
-rw-r--r--tests/lint_message_convention.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/tests/lint_message_convention.rs b/tests/lint_message_convention.rs
index 45e0d7336c1..493bd3bf56b 100644
--- a/tests/lint_message_convention.rs
+++ b/tests/lint_message_convention.rs
@@ -1,3 +1,4 @@
+use std::ffi::OsStr;
 use std::path::PathBuf;
 
 use regex::RegexSet;
@@ -47,7 +48,7 @@ impl Message {
             .filter(|line| regex_set.matches(line).matched_any())
             // ignore exceptions
             .filter(|line| !exceptions_set.matches(line).matched_any())
-            .map(|s| s.to_owned())
+            .map(ToOwned::to_owned)
             .collect::<Vec<String>>();
 
         Message { path, bad_lines }
@@ -71,17 +72,16 @@ fn lint_message_convention() {
 
     // gather all .stderr files
     let tests = test_dirs
-        .map(|dir| {
+        .flat_map(|dir| {
             std::fs::read_dir(dir)
                 .expect("failed to read dir")
                 .map(|direntry| direntry.unwrap().path())
         })
-        .flatten()
-        .filter(|file| matches!(file.extension().map(|s| s.to_str()), Some(Some("stderr"))));
+        .filter(|file| matches!(file.extension().map(OsStr::to_str), Some(Some("stderr"))));
 
     // get all files that have any "bad lines" in them
     let bad_tests: Vec<Message> = tests
-        .map(|path| Message::new(path))
+        .map(Message::new)
         .filter(|message| !message.bad_lines.is_empty())
         .collect();