Skip to content

Commit

Permalink
fix clippy lints on the tests
Browse files Browse the repository at this point in the history
  • Loading branch information
wfraser committed Sep 7, 2020
1 parent cd329fa commit 99ea355
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions tests/browser_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ lazy_static! {
};
}

fn iter_labels<'a, T>(vec: &'a Vec<(String, T)>) -> impl Iterator<Item=&'a str> {
vec.iter().map(|(label, _)| label.as_str())
fn iter_labels<T>(items: &[(String, T)]) -> impl Iterator<Item=&str> {
items.iter().map(|(label, _)| label.as_str())
}

trait VecExt<'a, T> {
Expand All @@ -35,7 +35,7 @@ trait VecExt<'a, T> {

impl<'a, T> VecExt<'a, T> for Vec<(String, T)> {
fn contains_label(&self, s: &str) -> bool {
iter_labels(self).find(|label| *label == s).is_some()
iter_labels(self).any(|label| label == s)
}
fn by_label(&'a self, s: &str) -> &'a T {
&self.iter()
Expand All @@ -50,12 +50,7 @@ impl<'a, T> VecExt<'a, T> for Vec<(String, T)> {

fn items_eq(a: &Item, b: &Item) -> bool {
match a {
Item::Root => {
match b {
Item::Root => true,
_ => false,
}
}
Item::Root => matches!(b, Item::Root),
Item::Def(a) => {
match b {
Item::Def(b) => {
Expand Down

0 comments on commit 99ea355

Please sign in to comment.