mirror of
https://github.com/RGBCube/dix
synced 2025-07-28 12:17:45 +00:00
src/main.rs: small refactor for readability
This commit is contained in:
parent
6295610028
commit
d5f2a5d7ba
1 changed files with 17 additions and 17 deletions
34
src/main.rs
34
src/main.rs
|
@ -74,8 +74,8 @@ fn main() {
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
// Compare the package names of both versions
|
// Compare the package names of both versions
|
||||||
let pre_keys: HashSet<String> = pre.clone().into_keys().collect();
|
let pre_keys: HashSet<String> = pre.keys().map(|k| k.clone()).collect();
|
||||||
let post_keys: HashSet<String> = post.clone().into_keys().collect();
|
let post_keys: HashSet<String> = post.keys().map(|k| k.clone()).collect();
|
||||||
// get the intersection of the package names for version changes
|
// get the intersection of the package names for version changes
|
||||||
let maybe_changed: HashSet<_> = pre_keys.intersection(&post_keys).collect();
|
let maybe_changed: HashSet<_> = pre_keys.intersection(&post_keys).collect();
|
||||||
|
|
||||||
|
@ -117,22 +117,22 @@ fn main() {
|
||||||
if p.is_empty() {
|
if p.is_empty() {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
let version_pre = pre.get(p);
|
|
||||||
let version_post = post.get(p);
|
|
||||||
|
|
||||||
if let (Some(ver_pre), Some(ver_post)) = (version_pre, version_post) {
|
// can not fail since maybe_changed is the union of the keys of pre and post
|
||||||
if ver_pre != ver_post {
|
let ver_pre = pre.get(p).unwrap();
|
||||||
// println!("C: {p} @ {ver_pre} -> {ver_post}");
|
let ver_post = post.get(p).unwrap();
|
||||||
println!(
|
|
||||||
"{} {} {} {} {} {}",
|
if ver_pre != ver_post {
|
||||||
"[C:]".purple().bold(),
|
// println!("C: {p} @ {ver_pre} -> {ver_post}");
|
||||||
p,
|
println!(
|
||||||
"@".yellow(),
|
"{} {} {} {} {} {}",
|
||||||
ver_pre.yellow(),
|
"[C:]".purple().bold(),
|
||||||
"~>".purple(),
|
p,
|
||||||
ver_post.cyan()
|
"@".yellow(),
|
||||||
);
|
ver_pre.yellow(),
|
||||||
}
|
"~>".purple(),
|
||||||
|
ver_post.cyan()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if args.closure_size {
|
if args.closure_size {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue