fix FP with needless_raw_string_hashes
This commit is contained in:
parent
f54275f20f
commit
5b790ff9e0
@ -616,7 +616,7 @@ fn check_should_panic_reason(cx: &LateContext<'_>, attr: &Attribute) {
|
||||
attr.span,
|
||||
"#[should_panic] attribute without a reason",
|
||||
"consider specifying the expected panic",
|
||||
r#"#[should_panic(expected = /* panic message */)]"#.into(),
|
||||
"#[should_panic(expected = /* panic message */)]".into(),
|
||||
Applicability::HasPlaceholders,
|
||||
);
|
||||
}
|
||||
|
@ -96,8 +96,9 @@ fn check_expr(&mut self, cx: &EarlyContext<'_>, expr: &Expr) {
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
return;
|
||||
if !matches!(cx.get_lint_level(NEEDLESS_RAW_STRINGS), rustc_lint::Allow) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
let req = {
|
||||
|
@ -21,4 +21,7 @@ fn main() {
|
||||
multiline
|
||||
string
|
||||
";
|
||||
|
||||
r"rust";
|
||||
r"hello world";
|
||||
}
|
||||
|
@ -21,4 +21,7 @@ fn main() {
|
||||
multiline
|
||||
string
|
||||
"#;
|
||||
|
||||
r###"rust"###;
|
||||
r#"hello world"#;
|
||||
}
|
||||
|
@ -163,5 +163,29 @@ LL | string
|
||||
LL ~ ";
|
||||
|
|
||||
|
||||
error: aborting due to 13 previous errors
|
||||
error: unnecessary hashes around raw string literal
|
||||
--> $DIR/needless_raw_string_hashes.rs:25:5
|
||||
|
|
||||
LL | r###"rust"###;
|
||||
| ^^^^^^^^^^^^^
|
||||
|
|
||||
help: remove all the hashes around the literal
|
||||
|
|
||||
LL - r###"rust"###;
|
||||
LL + r"rust";
|
||||
|
|
||||
|
||||
error: unnecessary hashes around raw string literal
|
||||
--> $DIR/needless_raw_string_hashes.rs:26:5
|
||||
|
|
||||
LL | r#"hello world"#;
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
||||
help: remove all the hashes around the literal
|
||||
|
|
||||
LL - r#"hello world"#;
|
||||
LL + r"hello world";
|
||||
|
|
||||
|
||||
error: aborting due to 15 previous errors
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user