about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--clippy_lints/src/raw_strings.rs2
-rw-r--r--tests/ui/needless_raw_string_hashes.fixed4
-rw-r--r--tests/ui/needless_raw_string_hashes.rs4
3 files changed, 9 insertions, 1 deletions
diff --git a/clippy_lints/src/raw_strings.rs b/clippy_lints/src/raw_strings.rs
index f45bb1ef3e1..0e964ec4724 100644
--- a/clippy_lints/src/raw_strings.rs
+++ b/clippy_lints/src/raw_strings.rs
@@ -95,7 +95,7 @@ impl EarlyLintPass for RawStrings {
                 // `once` so a raw string ending in hashes is still checked
                 let num = str.as_bytes().iter().chain(once(&0)).try_fold(0u8, |acc, &b| {
                     match b {
-                        b'"' => (following_quote, req) = (true, 1),
+                        b'"' if !following_quote => (following_quote, req) = (true, 1),
                         // I'm a bit surprised the compiler didn't optimize this out, there's no
                         // branch but it still ends up doing an unnecessary comparison, it's:
                         // - cmp r9b,1h
diff --git a/tests/ui/needless_raw_string_hashes.fixed b/tests/ui/needless_raw_string_hashes.fixed
index e4d7d8fb017..a9a6282628e 100644
--- a/tests/ui/needless_raw_string_hashes.fixed
+++ b/tests/ui/needless_raw_string_hashes.fixed
@@ -16,4 +16,8 @@ fn main() {
     cr#"Hello "world"!"#;
     cr####" "### "## "# "####;
     cr###" "aa" "# "## "###;
+    // Issue #11068, do not lint
+    r##"a"#"a"##;
+    br##"a"#"a"##;
+    cr##"a"#"a"##;
 }
diff --git a/tests/ui/needless_raw_string_hashes.rs b/tests/ui/needless_raw_string_hashes.rs
index e2d85c52e78..baa97d86470 100644
--- a/tests/ui/needless_raw_string_hashes.rs
+++ b/tests/ui/needless_raw_string_hashes.rs
@@ -16,4 +16,8 @@ fn main() {
     cr##"Hello "world"!"##;
     cr######" "### "## "# "######;
     cr######" "aa" "# "## "######;
+    // Issue #11068, do not lint
+    r##"a"#"a"##;
+    br##"a"#"a"##;
+    cr##"a"#"a"##;
 }