Skip to content

syntax: allow stmt/expr macro invocations to be delimited by {}. #12497

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

Closed
wants to merge 1 commit into from

Conversation

huonw
Copy link
Member

@huonw huonw commented Feb 23, 2014

This makes using control-flow-y macros like spawn! { ... } more fluent
and natural.

cc #11892.

@flaper87
Copy link
Contributor

I like this proposal! 👍

@lilyball
Copy link
Contributor

👍

@erickt
Copy link
Contributor

erickt commented Feb 23, 2014

I'm looking forward to this. Can you add a compile-fail test to error out on foo!( ... } and foo!{ ... )?

This makes using control-flow-y macros like `spawn! { ... }` more fluent
and natural.

cc rust-lang#11892.
@huonw
Copy link
Member Author

huonw commented Feb 23, 2014

Done.

@flaper87
Copy link
Contributor

mmh, I still think we could have avoided copying that error message around. +1 for this syntax improvement, though.

@huonw
Copy link
Member Author

huonw commented Feb 23, 2014

There's quite a few places that have similar "expected x but found y" messages (and the messages aren't even consistent about "ident" vs. "identifier"); I imagine a clean-up patch that collects them together would be accepted.

@bors bors closed this in 4243cad Feb 25, 2014
@huonw huonw deleted the macro-braces branch February 26, 2014 01:41
flip1995 pushed a commit to flip1995/rust that referenced this pull request Apr 4, 2024
…atting-false-positive-when-commented-else, r=Alexendoo

fix: `suspicious_else_formatting` false positive when else is included …

This PR addresses an issue where invalid suggestions are generated for `if-else` formatting if comments contain the keyword `else`.

The root of the problem is identified [here](https://github.com/rust-lang/rust-clippy/blob/95c62ffae9bbce793f68a6f1473e3fc24af19bdd/clippy_lints/src/formatting.rs#L217). Specifically, when a comment contains the word `else`, the lint mistakenly interprets it as part of an `if-else` clause. This misinterpretation leads to an incorrect splitting of the snippet, resulting in erroneous suggestions.

fixes: rust-lang#12497

changelog: [`suspicious_else_formatting`]: Fixes invalid suggestions when comments include word else
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants