mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-24 05:33:27 +00:00
Auto merge of #11078 - Centri3:11068, r=llogiq
[`needless_raw_string_hashes`]: Only reset hashes needed if not following quote Fixes #11068 changelog: none
This commit is contained in:
commit
ba3bd8f0f1
3 changed files with 9 additions and 1 deletions
|
@ -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
|
||||
|
|
|
@ -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"##;
|
||||
}
|
||||
|
|
|
@ -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"##;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue