mirror of
https://github.com/github/codeql.git
synced 2026-06-29 16:47:09 +02:00
yeast-macros: Add error message to defensive expect_ident in parse_ctx_or_implicit
The empty error string passed to `expect_ident` was dead code (the preceding lookahead has already confirmed the token is an ident), but it would have been a confusing message if it ever fired. Replace with an explicit "unreachable" string that makes the intent clearer to readers. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -304,7 +304,8 @@ fn parse_ctx_or_implicit(tokens: &mut Tokens) -> Ident {
|
||||
&& matches!(lookahead.next(), Some(TokenTree::Punct(p)) if p.as_char() == ',');
|
||||
|
||||
if is_explicit {
|
||||
let ctx = expect_ident(tokens, "").unwrap();
|
||||
let ctx = expect_ident(tokens, "unreachable: ident was just peeked")
|
||||
.expect("unreachable: ident was just peeked");
|
||||
let _ = tokens.next(); // consume comma
|
||||
ctx
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user