-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
False Positive: needless_raw_string_hashes #11402
Comments
Update the toolchain to rust-1.72.0. This brought with it a new clippy check for needless '#'s for string literals. However, this is a false positive and is being tracked here[[0]]. [0]: rust-lang/rust-clippy#11402 Signed-off-by: Fintan Halpenny <[email protected]> X-Clacks-Overhead: GNU Terry Pratchett
Another false positive is: : |
I fail to see how either of these are false positives. You can remove the hashes just fine.
The test that doesn't emit anything looks like a FN. |
No. Removing the hashes caused unit tests to start failing. So something is changed in the string |
I'm also not entirely sure what the problem here is. That suggestion looks good to me, and the snippet it suggests also compares equal to your original string, so I don't know how that caused tests to fail. fn main() {
let a = r#"escaped single quote \' is false positive"#;
let b = r"escaped single quote \' is false positive"; // clippy's suggestion
dbg!(a == b);
}
|
Removing the hashes should only change the string if there is a |
We are parsing the string in this test, more i can't say. It seems to make a difference. and i just checked, the string also contains double quotes |
I see, I didn't realise that the |
Update the toolchain to rust-1.72.0. This brought with it a new clippy check for needless '#'s for string literals. However, this is a false positive and is being tracked here[[0]]. [0]: rust-lang/rust-clippy#11402 Signed-off-by: Fintan Halpenny <[email protected]> X-Clacks-Overhead: GNU Terry Pratchett
… r=flip1995 Move `needless_raw_string_hashes` to `pedantic` IMO it doesn't improve code enough to be warn by default. [It seems to be unclear to some also](#11402), but that can probably be remedied separately changelog: Moved [`needless_raw_string_hashes`] to `pedantic` (Now allow-by-default) [#11415](#11415) r? `@flip1995`
@FintanH: I've tried reproducing this, but so far couldn't. For example, this reduced playground snippet with your two test cases produces the Do you have a minimal, standalone example that shows the issue? |
Well I did report it with 1.72 whereas that playground is running 1.75, so maybe that's playing a factor? :) Judging from the conversation, it seems like the fix was to remove the |
Summary
On our
radicle-surf
project, the lint job failed due to this clippy warning. This is the job and the offending code is:What's strange is there is a very similar test below that does not set off the clippy warning:
Lint Name
needless_raw_string_hashes
Reproducer
I tried this code:
I saw this happen:
I expected for the lint job to pass. It can be reproduced in the git repository by running
scripts/ci/lint
.Version
Additional Labels
No response
The text was updated successfully, but these errors were encountered: