Skip to content

Commit

Permalink
format: remove unreachable condition
Browse files Browse the repository at this point in the history
  • Loading branch information
ljedrz committed Dec 14, 2018
1 parent 97a0bd6 commit 37a3b7c
Showing 1 changed file with 9 additions and 22 deletions.
31 changes: 9 additions & 22 deletions src/libsyntax_ext/format.rs
Expand Up @@ -158,28 +158,15 @@ fn parse_args(ecx: &mut ExtCtxt,
} // accept trailing commas
if named || (p.token.is_ident() && p.look_ahead(1, |t| *t == token::Eq)) {
named = true;
let ident = match p.token {
token::Ident(i, _) => {
p.bump();
i
}
_ if named => {
ecx.span_err(
p.span,
"expected ident, positional arguments cannot follow named arguments",
);
return None;
}
_ => {
ecx.span_err(
p.span,
&format!(
"expected ident for named argument, found `{}`",
p.this_token_to_string()
),
);
return None;
}
let ident = if let token::Ident(i, _) = p.token {
p.bump();
i
} else {
ecx.span_err(
p.span,
"expected ident, positional arguments cannot follow named arguments",
);
return None;
};
let name: &str = &ident.as_str();

Expand Down

0 comments on commit 37a3b7c

Please sign in to comment.