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

Invalid suggestion for panic![123] #82111

Closed
m-ou-se opened this issue Feb 14, 2021 · 1 comment · Fixed by #82113
Closed

Invalid suggestion for panic![123] #82111

m-ou-se opened this issue Feb 14, 2021 · 1 comment · Fixed by #82113
Assignees
Labels
A-suggestion-diagnostics Area: Suggestions generated by the compiler applied by `cargo fix`. D-invalid-suggestion Diagnostics: A structured suggestion resulting in incorrect code.

Comments

@m-ou-se
Copy link
Member

m-ou-se commented Feb 14, 2021

The non_fmt_panic lint now suggests to replace panic![123] by std::panic::panic_any(123]. Calling the panic macro with [] or {} is uncommon, but it'd be good if it doesn't suggest invalid code.

@m-ou-se m-ou-se added A-suggestion-diagnostics Area: Suggestions generated by the compiler applied by `cargo fix`. D-invalid-suggestion Diagnostics: A structured suggestion resulting in incorrect code. labels Feb 14, 2021
@m-ou-se m-ou-se self-assigned this Feb 14, 2021
@m-ou-se
Copy link
Member Author

m-ou-se commented Feb 14, 2021

A problem here is that panic! { 123 } doesn't need a ;, while panic_any(123) might need a ; in that same context, depending on the context. It's probably not worth solving this case though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-suggestion-diagnostics Area: Suggestions generated by the compiler applied by `cargo fix`. D-invalid-suggestion Diagnostics: A structured suggestion resulting in incorrect code.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant