Skip to content

Commit 37a3b7c

Browse files
committed
format: remove unreachable condition
1 parent 97a0bd6 commit 37a3b7c

File tree

1 file changed

+9
-22
lines changed

1 file changed

+9
-22
lines changed

src/libsyntax_ext/format.rs

Lines changed: 9 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -158,28 +158,15 @@ fn parse_args(ecx: &mut ExtCtxt,
158158
} // accept trailing commas
159159
if named || (p.token.is_ident() && p.look_ahead(1, |t| *t == token::Eq)) {
160160
named = true;
161-
let ident = match p.token {
162-
token::Ident(i, _) => {
163-
p.bump();
164-
i
165-
}
166-
_ if named => {
167-
ecx.span_err(
168-
p.span,
169-
"expected ident, positional arguments cannot follow named arguments",
170-
);
171-
return None;
172-
}
173-
_ => {
174-
ecx.span_err(
175-
p.span,
176-
&format!(
177-
"expected ident for named argument, found `{}`",
178-
p.this_token_to_string()
179-
),
180-
);
181-
return None;
182-
}
161+
let ident = if let token::Ident(i, _) = p.token {
162+
p.bump();
163+
i
164+
} else {
165+
ecx.span_err(
166+
p.span,
167+
"expected ident, positional arguments cannot follow named arguments",
168+
);
169+
return None;
183170
};
184171
let name: &str = &ident.as_str();
185172

0 commit comments

Comments
 (0)