mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-13 13:48:50 +00:00
Merge #9150
9150: Unescape generated clippy lints r=lnicola a=Veykril Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
This commit is contained in:
commit
b68407fab8
2 changed files with 731 additions and 314 deletions
File diff suppressed because it is too large
Load diff
|
@ -109,6 +109,10 @@ struct ClippyLint {
|
|||
id: String,
|
||||
}
|
||||
|
||||
fn unescape(s: &str) -> String {
|
||||
s.replace(r#"\""#, "").replace(r#"\n"#, "\n").replace(r#"\r"#, "")
|
||||
}
|
||||
|
||||
fn generate_descriptor_clippy(buf: &mut String, path: &Path) -> Result<()> {
|
||||
let file_content = read_file(path)?;
|
||||
let mut clippy_lints: Vec<ClippyLint> = vec![];
|
||||
|
@ -135,6 +139,7 @@ fn generate_descriptor_clippy(buf: &mut String, path: &Path) -> Result<()> {
|
|||
.strip_prefix(prefix_to_strip)
|
||||
.expect("should be prefixed by what it does")
|
||||
.strip_suffix(suffix_to_strip)
|
||||
.map(unescape)
|
||||
.expect("should be suffixed by comma")
|
||||
.into();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue