mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-21 17:52:12 +03:00
Fix FP [needless_raw_string_hashes]
This commit is contained in:
@@ -95,7 +95,7 @@ fn check_expr(&mut self, cx: &EarlyContext<'_>, expr: &Expr) {
|
||||
// `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"##;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user