boop
This commit is contained in:
parent
c50dc62121
commit
1d3f6df896
|
@ -9,48 +9,46 @@ pub async fn check_missing(args: CheckMissingArgs) {
|
|||
let config: StickerConfig =
|
||||
serde_yaml::from_reader(config_file).expect("could not parse stickers.yml");
|
||||
|
||||
let stickers_for_sticker_sets: Vec<(String, Vec<String>)> = args
|
||||
let stickers_for_sticker_sets: Vec<(&String, &Vec<String>)> = args
|
||||
.sticker_sets
|
||||
.iter()
|
||||
.map(|pack_id| {
|
||||
return (
|
||||
pack_id.clone(),
|
||||
config.sticker_sets.get(pack_id).unwrap().clone(),
|
||||
);
|
||||
return (pack_id, config.sticker_sets.get(pack_id).unwrap());
|
||||
})
|
||||
.collect();
|
||||
|
||||
let missing_stickers: Vec<(String, Vec<String>)> = stickers_for_sticker_sets
|
||||
let missing_stickers: Vec<(&String, Vec<&String>)> = stickers_for_sticker_sets
|
||||
.iter()
|
||||
.map(|(sticker_set_name, sticker_set_stickers)| {
|
||||
return (
|
||||
sticker_set_name.clone(),
|
||||
*sticker_set_name,
|
||||
config
|
||||
.stickers
|
||||
.iter()
|
||||
.filter(|all_stickers_sticker| {
|
||||
!sticker_set_stickers.contains(all_stickers_sticker.0)
|
||||
})
|
||||
.map(|b| b.0.clone())
|
||||
.collect::<Vec<String>>(),
|
||||
.map(|b| b.0)
|
||||
.collect::<Vec<&String>>(),
|
||||
);
|
||||
})
|
||||
.collect();
|
||||
|
||||
let total_missing: Vec<String> = HashMap::<String, bool>::from_iter(
|
||||
let total_missing: Vec<&String> = HashMap::<&String, bool>::from_iter(
|
||||
missing_stickers
|
||||
.iter()
|
||||
.map(|(_pack_name, stickers)| stickers.clone())
|
||||
.collect::<Vec<Vec<String>>>()
|
||||
.collect::<Vec<Vec<&String>>>()
|
||||
.concat()
|
||||
.iter()
|
||||
.map(|sticker_name| (sticker_name.clone(), true)),
|
||||
.map(|sticker_name| (*sticker_name, true)),
|
||||
)
|
||||
.into_keys()
|
||||
.collect();
|
||||
|
||||
let missing_from_all: Vec<&String> = total_missing
|
||||
.iter()
|
||||
.clone()
|
||||
.into_iter()
|
||||
.filter(|missing_sticker| {
|
||||
return missing_stickers
|
||||
.iter()
|
||||
|
|
Loading…
Reference in a new issue