Skip to content

Commit

Permalink
Use .find() instead of .filter().next()
Browse files Browse the repository at this point in the history
  • Loading branch information
pickfire committed Apr 15, 2019
1 parent 4017736 commit 4f56cbd
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 4f56cbd

Please sign in to comment.