Repository navigation
Conversation
|
Thanks for the pull request, and welcome! You should hear from one of our reviewers after this PR gets at least 2 reviews from the community. Please see the contribution instructions for more information. |
missing_panic_message]missing_panic_message]
|
Lintcheck changes for f0fdf9b
This comment will be updated if you push new changes |
561e190 to
b8a6fb7
Compare
| // `punic_any(_)` passed a unit value as an argument | ||
| if !expr.span.from_expansion() | ||
| && let ExprKind::Call(name, [arg]) = expr.kind | ||
| && name.basic_res().is_diag_item(cx, sym::panic_any) | ||
| && cx.typeck_results().expr_ty(arg).is_unit() | ||
| { | ||
| span_lint_and_help( | ||
| cx, | ||
| MISSING_PANIC_MESSAGE, | ||
| expr.span, | ||
| "using `panic_any` with a unit value as an argument", | ||
| None, | ||
| "consider sending a meaningful message", | ||
| ); | ||
| } | ||
| } |
There was a problem hiding this comment.
🤔 should this be a separate lint?
I would find punic_any(()) a lot more suspicious than plain unimplemented!().. and therefore this part of the lint being in suspicious instead of restriction would make a lot of sense to me.
Maybe my intuition is wrong though.
There was a problem hiding this comment.
The four macros have default messages, but panic_any() doesn't. Using panic_any(()) might be wrong, so suspicious category is more suitable as you said.
There was a problem hiding this comment.
A split into two lints would be very handy in that case 😉
There was a problem hiding this comment.
Should I create new file?
|
r? @llogiq rustbot has assigned @llogiq for the project review. Use Why was this reviewer chosen?The reviewer was selected based on:
|
|
(make sure to squash your changes so that this does not hold up the PR 😉 ) |
d3e9d7f to
f0fdf9b
Compare
|
☔ The latest upstream changes (possibly #13598) made this pull request unmergeable. Please resolve the merge conflicts. |
Resolves #14843
LLM disclosure: I used LLM to refine my English
clippy_lints/src/missing_panic_message.rs: check -> assesstests/ui/missing_panic_message.rs: originally "The two lints do not conflict but are overlapped. Considering lint coverage, it is better that both of them catch this pattern"