We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 0e7db3a commit f9a4a9cCopy full SHA for f9a4a9c
1 file changed
rust-code-analysis-cli/src/formats.rs
@@ -61,17 +61,23 @@ impl Format {
61
Format::Yaml => ".yml",
62
};
63
64
- // Remove . / \ .. symbols from a path to create a unique filename
+ // Remove root /
65
+ let path = path.strip_prefix("/").unwrap_or(path);
66
+
67
+ // Remove root ./
68
+ let path = path.strip_prefix("./").unwrap_or(path);
69
70
+ // Replace .. symbol with "_" to create a unique filename
71
let cleaned_path: Vec<&str> = path
72
.iter()
- .filter(|v| {
- if let Some(s) = v.to_str() {
- ![".", ".."].contains(&s)
73
+ .map(|os_str| {
74
+ let s_str = os_str.to_str().unwrap();
75
+ if s_str == ".." {
76
+ "_"
77
} else {
- false
78
+ s_str
79
}
80
})
- .map(|s| s.to_str().unwrap())
81
.collect();
82
83
// Create the filename
0 commit comments