Skip to content
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

Inner attributes in block expressions get deleted #2073

Closed
matthew-mcallister opened this issue Oct 20, 2017 · 2 comments
Closed

Inner attributes in block expressions get deleted #2073

matthew-mcallister opened this issue Oct 20, 2017 · 2 comments
Labels
bug Panic, non-idempotency, invalid code, etc. poor-formatting

Comments

@matthew-mcallister
Copy link
Contributor

If you pass in input like this...

let x = {
    #![my_attr]
    do_something()
};
let x = #[my_attr] {
    do_something()
};

... what you get is this...

let x = { do_something() };
let x = #[my_attr]
{ do_something() };

The second case is just bad formatting due to assuming that the attribute appears on its own line. More concerning is the first case, in which actually meaningful code gets deleted.

@topecongiro topecongiro added bug Panic, non-idempotency, invalid code, etc. poor-formatting labels Oct 20, 2017
@topecongiro
Copy link
Contributor

We probably should disallow rewriting a block in a single line if there are any attributes.

@topecongiro
Copy link
Contributor

Closed via #2075.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Panic, non-idempotency, invalid code, etc. poor-formatting
Projects
None yet
Development

No branches or pull requests

2 participants