Skip to content

Commit

Permalink
no$
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonas Schievink committed Oct 12, 2020
1 parent 9c9d757 commit 2d4d178
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 32 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 2 additions & 31 deletions xtask/src/pre_cache.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
use std::{
fs::FileType,
path::{Path, PathBuf},
};
use std::path::Path;

use anyhow::Result;

use crate::not_bash::{fs2, rm_rf};
use crate::not_bash::rm_rf;

pub struct PreCacheCmd;

Expand All @@ -19,32 +16,6 @@ impl PreCacheCmd {
}
rm_rf(slow_tests_cookie)?;

for path in read_dir("./target/debug", FileType::is_file)? {
// Can't delete yourself on windows :-(
if !path.ends_with("xtask.exe") {
rm_rf(&path)?
}
}

fs2::remove_file("./target/.rustc_info.json")?;

Ok(())
}
}
fn read_dir(path: impl AsRef<Path>, cond: impl Fn(&FileType) -> bool) -> Result<Vec<PathBuf>> {
read_dir_impl(path.as_ref(), &cond)
}

fn read_dir_impl(path: &Path, cond: &dyn Fn(&FileType) -> bool) -> Result<Vec<PathBuf>> {
let mut res = Vec::new();
for entry in path.read_dir()? {
let entry = entry?;
let file_type = entry.file_type()?;
if cond(&file_type) {
res.push(entry.path())
}
}
Ok(res)
}

//

0 comments on commit 2d4d178

Please sign in to comment.