Skip to content

Commit

Permalink
fixup! Update src/cargo/ops/cargo_clean.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
osiewicz committed May 2, 2024
1 parent a49a2b9 commit 574d086
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions src/cargo/ops/cargo_clean.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)?;
}
Expand Down Expand Up @@ -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)?;
}
}
Expand Down

0 comments on commit 574d086

Please sign in to comment.