Skip to content

Commit

Permalink
fix: Restore compat with Rust 1.21
Browse files Browse the repository at this point in the history
  • Loading branch information
untitaker committed Sep 27, 2018
1 parent ef92e2b commit 6b263de
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/suggestions.rs
Expand Up @@ -71,8 +71,14 @@ where
.filter_map(|f| f.s.long)
.chain(subcommand.p.opts.iter().filter_map(|o| o.s.long));

let candidate = did_you_mean(arg, opts)?;
let score = args_rest.iter().position(|x| *x == subcommand.get_name())?;
let candidate = match did_you_mean(arg, opts) {
Some(candidate) => candidate,
None => return None
};
let score = match args_rest.iter().position(|x| *x == subcommand.get_name()) {
Some(score) => score,
None => return None
};

let suffix = format!(
"\n\tDid you mean to put '{}{}' after the subcommand '{}'?",
Expand Down

0 comments on commit 6b263de

Please sign in to comment.