Closed
Description
What it does
Checks for the use of more hashes that are necessary in r#…#
-style literals, and emits a warning about it telling you to use fewer hashes. Suggested name: needless_raw_string_hashes
; suggested categories: style
or pedantic
.
Advantage
- Code is kept more consistent; there are fewer ways to express one piece of logic.
- Code automatically self-documents the level of “rawness” needed in the string literal.
Drawbacks
- Sometimes for alignment purposes one might want to add more hashes than necessary.
- Maybe this should be in
rustfmt
instead?
Example
let s = r##"Hello "world"!"##;
Could be written as:
let s = r#"Hello "world"!"#;