mirror of
https://github.com/Noratrieb/cargo-minimize.git
synced 2026-01-14 16:35:01 +01:00
make sure roots are not deleted
This commit is contained in:
parent
825870651f
commit
af95ab5e10
1 changed files with 12 additions and 0 deletions
|
|
@ -1,6 +1,8 @@
|
||||||
use anyhow::{ensure, Context, Result};
|
use anyhow::{ensure, Context, Result};
|
||||||
use once_cell::sync::Lazy;
|
use once_cell::sync::Lazy;
|
||||||
use regex::Regex;
|
use regex::Regex;
|
||||||
|
use std::collections::hash_map::RandomState;
|
||||||
|
use std::collections::HashSet;
|
||||||
use std::fs::Permissions;
|
use std::fs::Permissions;
|
||||||
use std::io::BufWriter;
|
use std::io::BufWriter;
|
||||||
use std::os::unix::prelude::PermissionsExt;
|
use std::os::unix::prelude::PermissionsExt;
|
||||||
|
|
@ -153,6 +155,16 @@ fn build(path: &Path) -> Result<()> {
|
||||||
"Some REQUIRE-DELETED have not been deleted: {required_deleted:?}"
|
"Some REQUIRE-DELETED have not been deleted: {required_deleted:?}"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
let end_roots = HashSet::<_, RandomState>::from_iter(
|
||||||
|
get_roots(&proj_dir).context("getting final MINIMIZE-ROOTs")?,
|
||||||
|
);
|
||||||
|
for root in &start_roots {
|
||||||
|
ensure!(
|
||||||
|
end_roots.contains(root),
|
||||||
|
"{root} was not found after minimization"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue