Skip to content

Commit 3b22ba8

Browse files
hovinenbcopybara-github
authored andcommitted
Fix some clippy warnings.
The warnings are from here: https://github.com/google/googletest-rust/actions/runs/4690847213/jobs/8314529047 This will reduce the likelihood that contributors encounter spurious Clippy warnings from code they did not write when they make PRs. This does not fix the warning in test_outcome.rs, since that does not have as straightforward a fix. PiperOrigin-RevId: 524240047
1 parent 3c1bebf commit 3b22ba8

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

googletest/src/matchers/container_eq_matcher.rs

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -220,18 +220,12 @@ fn build_explanation<T: Debug, U: Debug>(missing: Vec<T>, unexpected: Vec<U>) ->
220220
}
221221

222222
impl<const N: usize> ContainerEqMatcher<[&str; N]> {
223-
fn get_missing_str_items(&self, actual: &Vec<String>) -> Vec<&str> {
224-
self.expected
225-
.into_iter()
226-
.filter(|i| actual.into_iter().find(|j| &j.as_str() == i).is_none())
227-
.collect()
228-
}
229-
230-
fn get_unexpected_string_items<'a>(&self, actual: &'a Vec<String>) -> Vec<&'a String> {
231-
actual
232-
.into_iter()
233-
.filter(|i| self.expected.into_iter().find(|j| j == &i.as_str()).is_none())
234-
.collect()
223+
fn get_missing_str_items(&self, actual: &[String]) -> Vec<&str> {
224+
self.expected.into_iter().filter(|i| !actual.iter().any(|j| j == i)).collect()
225+
}
226+
227+
fn get_unexpected_string_items<'a>(&self, actual: &'a [String]) -> Vec<&'a String> {
228+
actual.iter().filter(|i| !self.expected.into_iter().any(|j| j == i.as_str())).collect()
235229
}
236230
}
237231

0 commit comments

Comments
 (0)