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

fix FP with needless_raw_string_hashes #11518

Merged
merged 1 commit into from Sep 21, 2023
Merged

Conversation

kiscad
Copy link
Contributor

@kiscad kiscad commented Sep 17, 2023

changelog: Fix [needless_raw_string_hashes]: Continue the lint checking of raw string when needless_raw_strings is allowed.

fix #11420

@rustbot
Copy link
Collaborator

rustbot commented Sep 17, 2023

r? @Alexendoo

(rustbot has picked a reviewer for you, use r? to override)

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Sep 17, 2023
@@ -96,8 +96,9 @@ impl EarlyLintPass for RawStrings {
);
},
);

return;
if !matches!(cx.get_lint_level(NEEDLESS_RAW_STRINGS), rustc_lint::Allow) {
Copy link
Member

@J-ZhengLi J-ZhengLi Sep 21, 2023

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.

Copy link
Contributor Author

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.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh~ right, my bad

@Alexendoo
Copy link
Member

Thanks! @bors r+

@bors
Copy link
Collaborator

bors commented Sep 21, 2023

📌 Commit 5b790ff has been approved by Alexendoo

It is now in the queue for this repository.

@bors
Copy link
Collaborator

bors commented Sep 21, 2023

⌛ Testing commit 5b790ff with merge 4d143d7...

@bors
Copy link
Collaborator

bors commented Sep 21, 2023

☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test
Approved by: Alexendoo
Pushing 4d143d7 to master...

@bors bors merged commit 4d143d7 into rust-lang:master Sep 21, 2023
9 checks passed
tamird added a commit to aya-rs/aya that referenced this pull request Sep 27, 2023
```
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).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties
Projects
None yet
Development

Successfully merging this pull request may close these issues.

False negative with needless_raw_string_hashes
5 participants