Skip to content

Commit

Permalink
Merge pull request #1766 from pickfire/fix-lints
Browse files Browse the repository at this point in the history
Use .find() instead of .filter().next()
  • Loading branch information
kinnison authored Apr 15, 2019
2 parents ed45c1d + 4f56cbd commit 858f5a4
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/cli/rustup_mode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1140,8 +1140,7 @@ impl FromStr for CompletionCommand {
fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
match COMPLETIONS
.iter()
.filter(|&(val, _)| val.eq_ignore_ascii_case(s))
.next()
.find(|&(val, _)| val.eq_ignore_ascii_case(s))
{
Some(&(_, cmd)) => Ok(cmd),
None => {
Expand All @@ -1160,7 +1159,7 @@ impl FromStr for CompletionCommand {

impl fmt::Display for CompletionCommand {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match COMPLETIONS.iter().filter(|&(_, cmd)| cmd == self).next() {
match COMPLETIONS.iter().find(|&(_, cmd)| cmd == self) {
Some(&(val, _)) => write!(f, "{}", val),
None => unreachable!(),
}
Expand Down

0 comments on commit 858f5a4

Please sign in to comment.