Skip to content

Commit

Permalink
Update refactor according to code review
Browse files Browse the repository at this point in the history
  • Loading branch information
james9909 committed Sep 25, 2019
1 parent 7e8afe2 commit 2f34576
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions clippy_lints/src/copies.rs
Original file line number Diff line number Diff line change
Expand Up @@ -305,15 +305,10 @@ fn search_common_cases<'a, T, Eq>(exprs: &'a [T], eq: &Eq) -> Option<(&'a T, &'a
where
Eq: Fn(&T, &T) -> bool,
{
match exprs.len().cmp(&2) {
Ordering::Greater | Ordering::Less => None,
Ordering::Equal => {
if eq(&exprs[0], &exprs[1]) {
Some((&exprs[0], &exprs[1]))
} else {
None
}
},
if exprs.len() == 2 && eq(&exprs[0], &exprs[1]) {
Some((&exprs[0], &exprs[1]))
} else {
None
}
}

Expand Down

0 comments on commit 2f34576

Please sign in to comment.