-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Closed
Copy link
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thingI-false-negativeIssue: The lint should have been triggered on code, but wasn'tIssue: The lint should have been triggered on code, but wasn't
Description
Summary
needless_raw_strings
and needless_raw_string_hashes
does not work when the string is inside macros.
Lint Name
needless_raw_strings, needless_raw_string_hashes
Reproducer
#![warn(clippy::needless_raw_strings, clippy::needless_raw_string_hashes)]
let _ = r"SELECT * FROM posts"; // needless-raw-strings
let _ = r#"SELECT * FROM posts"#; // needless-raw-strings
let _ = r##"SELECT * FROM "posts""##; // needless-raw-string-hashes
// None of lines below triggers any warning
println!(r"SELECT * FROM posts");
println!(r#"SELECT * FROM posts"#);
println!(r##"SELECT * FROM "posts""##);
// No warning when used with sqlx
sqlx::query!(
r#"
SELECT * FROM posts
"#,
)
.fetch_all(&pool)
.await
.unwrap();
Version
rustc 1.83.0-nightly (363ae41 2024-09-24)
binary: rustc
commit-hash: 363ae41
commit-date: 2024-09-24
host: x86_64-unknown-linux-gnu
release: 1.83.0-nightly
LLVM version: 19.1.0
Metadata
Metadata
Assignees
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thingI-false-negativeIssue: The lint should have been triggered on code, but wasn'tIssue: The lint should have been triggered on code, but wasn't