-
Notifications
You must be signed in to change notification settings - Fork 13k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor mbe a tiny bit #64759
Refactor mbe a tiny bit #64759
Conversation
(rust_highfive has picked a reviewer for you, use r? to override) |
9955e2c
to
538437e
Compare
@bors r+ |
📌 Commit f60a873 has been approved by |
|
||
/// Generates an appropriate parsing failure message. For EOF, this is "unexpected end...". For | ||
/// other tokens, this is "unexpected token...". | ||
fn parse_failure_msg(tok: &Token) -> String { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not
fn parse_failure_msg(tok: &Token) -> String {
if let token::Eof = tok.kind {
return "unexpected end of macro invocation".to_string();
}
format!("no rules expected the token `{}`", pprust::token_to_string(tok))
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just haven't looked into the function body at all :-) I think that the best way to format it would probably be
fn parse_failure_msg(tok: &Token) -> String {
match tok.kind {
token::Eof => "unexpected end of macro invocation".to_string(),
_ => format!("no rules expected the token `{}`", pprust::token_to_string(tok)),
}
}
Not a fan of if let
with an else case
Refactor mbe a tiny bit
Rollup of 6 pull requests Successful merges: - #62975 (Almost fully deprecate hir::map::Map.hir_to_node_id) - #64386 (use `sign` variable in abs and wrapping_abs methods) - #64508 (or-patterns: Push `PatKind/PatternKind::Or` at top level to HIR & HAIR) - #64738 (Add const-eval support for SIMD types, insert, and extract) - #64759 (Refactor mbe a tiny bit) - #64764 (Master is now 1.40 ) Failed merges: r? @ghost
No description provided.