Skip to content

Refactor mbe a tiny bit - #64759

Merged
bors merged 3 commits into
rust-lang:masterfrom
matklad:simplify-macro
Sep 25, 2019
Merged

Refactor mbe a tiny bit#64759
bors merged 3 commits into
rust-lang:masterfrom
matklad:simplify-macro

Conversation

@matklad

Copy link
Copy Markdown
Contributor

No description provided.

@rust-highfive

Copy link
Copy Markdown
Contributor

r? @petrochenkov

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfiverust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Sep 25, 2019
@petrochenkov

Copy link
Copy Markdown
Contributor

@bors r+

@bors

bors commented Sep 25, 2019

Copy link
Copy Markdown
Collaborator

📌 Commit f60a873 has been approved by petrochenkov

@borsbors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 25, 2019

/// 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 {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not

fnparse_failure_msg(tok:&Token) -> String{iflet token::Eof = tok.kind{return"unexpected end of macro invocation".to_string();}format!("no rules expected the token `{}`", pprust::token_to_string(tok))}

Copy link
Copy Markdown
ContributorAuthor

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

fnparse_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

Centril added a commit to Centril/rust that referenced this pull request Sep 25, 2019
@CentrilCentril mentioned this pull request Sep 25, 2019
bors added a commit that referenced this pull request Sep 25, 2019
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
@bors
bors merged commit f60a873 into rust-lang:masterSep 25, 2019
@matklad
matklad deleted the simplify-macro branch September 25, 2019 19:13
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-borsStatus: Waiting on bors to run and complete tests. Bors will change the label on completion.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@matklad@rust-highfive@petrochenkov@bors@llogiq