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
fix FP with needless_raw_string_hashes #11518
Conversation
r? @Alexendoo (rustbot has picked a reviewer for you, use r? to override) |
@@ -96,8 +96,9 @@ impl EarlyLintPass for RawStrings { | |||
); | |||
}, | |||
); | |||
|
|||
return; | |||
if !matches!(cx.get_lint_level(NEEDLESS_RAW_STRINGS), rustc_lint::Allow) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a small style nit: There's a clippy wrapper called is_lint_allowed
, it should work here with the expr's HirId, I think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks that is_lint_allowed
need a LateContext
argument, but we have only EarlyContext
here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh~ right, my bad
Thanks! @bors r+ |
☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test |
``` warning: unnecessary hashes around raw string literal --> xtask/src/docs.rs:70:17 | 70 | indoc! {r#" | _________________^ 71 | | User-Agent:* 72 | | Disallow: / 73 | | "#}, | |______^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_raw_string_hashes = note: `#[warn(clippy::needless_raw_string_hashes)]` on by default help: remove all the hashes around the literal | 70 ~ indoc! {r" 71 | User-Agent:* 72 | Disallow: / 73 ~ "}, | ``` This false negative was fixed in rust-lang/rust-clippy#11518 (the title incorrectly says false positive).
changelog: Fix [
needless_raw_string_hashes
]: Continue the lint checking of raw string whenneedless_raw_strings
is allowed.fix #11420