mirror of
https://github.com/rust-lang/cargo
synced 2024-10-30 03:28:38 +00:00
fixup! Update src/cargo/ops/cargo_clean.rs
This commit is contained in:
parent
a49a2b9584
commit
574d086cb3
1 changed files with 9 additions and 8 deletions
|
@ -254,11 +254,11 @@ fn clean_specs(
|
|||
let paths = [
|
||||
// Remove dep-info file generated by rustc. It is not tracked in
|
||||
// file_types. It does not have a prefix.
|
||||
(path_dash.clone(), ".d"),
|
||||
(path_dash, ".d"),
|
||||
// Remove split-debuginfo files generated by rustc.
|
||||
(path_dot.clone(), ".o"),
|
||||
(path_dot.clone(), ".dwo"),
|
||||
(path_dot.clone(), ".dwp"),
|
||||
(path_dot, ".o"),
|
||||
(path_dot, ".dwo"),
|
||||
(path_dot, ".dwp"),
|
||||
];
|
||||
clean_ctx.rm_rf_prefix_list(&dir_glob_str, &paths)?;
|
||||
}
|
||||
|
@ -347,14 +347,15 @@ impl<'gctx> CleanContext<'gctx> {
|
|||
fn rm_rf_prefix_list(
|
||||
&mut self,
|
||||
pattern: &str,
|
||||
path_matchers: &[(Rc<str>, &str)],
|
||||
path_matchers: &[(&str, &str)],
|
||||
) -> CargoResult<()> {
|
||||
for path in glob::glob(pattern)? {
|
||||
let path = path?;
|
||||
let filename = path.file_name().and_then(|name| name.to_str()).unwrap();
|
||||
if path_matchers.iter().any(|(prefix, suffix)| {
|
||||
filename.starts_with(&**prefix) && filename.ends_with(suffix)
|
||||
}) {
|
||||
if path_matchers
|
||||
.iter()
|
||||
.any(|(prefix, suffix)| filename.starts_with(prefix) && filename.ends_with(suffix))
|
||||
{
|
||||
self.rm_rf(&path)?;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue