don't lint needless_raw_string_hashes when it's unnecessary
This commit is contained in:
parent
ec765d9516
commit
cb52d19ce1
5 changed files with 31 additions and 36 deletions
|
|
@ -71,6 +71,20 @@ impl EarlyLintPass for RawStrings {
|
|||
return;
|
||||
}
|
||||
|
||||
if !lit.symbol.as_str().contains(['\\', '"']) {
|
||||
span_lint_and_sugg(
|
||||
cx,
|
||||
NEEDLESS_RAW_STRING,
|
||||
expr.span,
|
||||
"unnecessary raw string literal",
|
||||
"try",
|
||||
format!("{}\"{}\"", prefix.replace('r', ""), lit.symbol),
|
||||
Applicability::MachineApplicable,
|
||||
);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
#[expect(clippy::cast_possible_truncation)]
|
||||
let req = lit.symbol.as_str().as_bytes()
|
||||
.split(|&b| b == b'"')
|
||||
|
|
@ -92,18 +106,6 @@ impl EarlyLintPass for RawStrings {
|
|||
Applicability::MachineApplicable,
|
||||
);
|
||||
}
|
||||
|
||||
if !lit.symbol.as_str().contains(['\\', '"']) {
|
||||
span_lint_and_sugg(
|
||||
cx,
|
||||
NEEDLESS_RAW_STRING,
|
||||
expr.span,
|
||||
"unnecessary raw string literal",
|
||||
"try",
|
||||
format!("{}\"{}\"", prefix.replace('r', ""), lit.symbol),
|
||||
Applicability::MachineApplicable,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue