Fix FP [needless_raw_string_hashes
]
This commit is contained in:
parent
ea4ca225fb
commit
9a581077d4
@ -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…
x
Reference in New Issue
Block a user