6

New lint `if_then_panic` by Labelray · Pull Request #7669 · rust-lang/rust-clipp...

 2 years ago
source link: https://github.com/rust-lang/rust-clippy/pull/7669
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Copy link

Collaborator

camsteffen commented 28 days ago

edited

Use cx.sess().source_map().is_multiline(span) to make sure the condition fits on on line as noted in the issue. Add a negative test for this.

I think providing a code suggestion is important for this lint. The fix may not be intuitive and people may not be aware that assert! accepts a message and formatting args. We probably need PanicMacroExpn similar to FormatExpn.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK