Skip to content

Commit 5370576

Browse files
committed
fix clippy lint warnings
1 parent b119b65 commit 5370576

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

tests/lint_message_convention.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
use std::ffi::OsStr;
12
use std::path::PathBuf;
23

34
use regex::RegexSet;
@@ -47,7 +48,7 @@ impl Message {
4748
.filter(|line| regex_set.matches(line).matched_any())
4849
// ignore exceptions
4950
.filter(|line| !exceptions_set.matches(line).matched_any())
50-
.map(|s| s.to_owned())
51+
.map(ToOwned::to_owned)
5152
.collect::<Vec<String>>();
5253

5354
Message { path, bad_lines }
@@ -71,17 +72,16 @@ fn lint_message_convention() {
7172

7273
// gather all .stderr files
7374
let tests = test_dirs
74-
.map(|dir| {
75+
.flat_map(|dir| {
7576
std::fs::read_dir(dir)
7677
.expect("failed to read dir")
7778
.map(|direntry| direntry.unwrap().path())
7879
})
79-
.flatten()
80-
.filter(|file| matches!(file.extension().map(|s| s.to_str()), Some(Some("stderr"))));
80+
.filter(|file| matches!(file.extension().map(OsStr::to_str), Some(Some("stderr"))));
8181

8282
// get all files that have any "bad lines" in them
8383
let bad_tests: Vec<Message> = tests
84-
.map(|path| Message::new(path))
84+
.map(Message::new)
8585
.filter(|message| !message.bad_lines.is_empty())
8686
.collect();
8787

0 commit comments

Comments
 (0)