From: Ben Pfaff Date: Mon, 13 Oct 2025 02:36:57 +0000 (-0700) Subject: work X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=168f86fb1215410407764868062908b5374b7cc1;p=pspp work --- diff --git a/rust/pspp/src/output.rs b/rust/pspp/src/output.rs index 913c8756e5..1ac438c77a 100644 --- a/rust/pspp/src/output.rs +++ b/rust/pspp/src/output.rs @@ -807,7 +807,7 @@ pub struct Criteria(pub Vec); impl Criteria { /// Returns a new output item whose children are all the (direct and /// indirect) children of `item` that meet the criteria. - pub fn apply(&self, item: Item) -> Item { + pub fn apply(&self, mut item: Item) -> Item { fn take_children(item: &Item) -> Vec<&Item> { item.details.children().iter().map(|item| &**item).collect() } @@ -924,7 +924,7 @@ impl Criteria { } } fn unflatten_item(mut item: Item, include: &mut bit_vec::Iter, out: &mut Vec>) { - let include_item = include.next().unwrap_or_default(); //XXX should just be unwrap + let include_item = include.next().unwrap(); if let Some(children) = item.details.mut_children() { if !include_item { unflatten_items(take(children), include, out); @@ -951,7 +951,11 @@ impl Criteria { } let mut output = Vec::new(); - unflatten_item(item, &mut include.iter(), &mut output); + unflatten_items( + take(item.details.mut_children().unwrap()), + &mut include.iter(), + &mut output, + ); Heading(output).into_item().with_label("Output") } } @@ -1081,12 +1085,12 @@ struct SelectionArgs { instances: Vec, /// Include hidden objects in the output (by default, they are excluded) - #[arg(long, required = false, action = ArgAction::Append)] + #[arg(long, required = false, action = ArgAction::Append, num_args = 0, value_parser = value_parser!(bool), default_missing_value = "true", default_value = "false")] show_hidden: bool, /// Include only objects that cause an error when read (by default, objects /// with and without errors are included). - #[arg(long, required = false, action = ArgAction::Append)] + #[arg(long, required = false, action = ArgAction::Append, num_args = 0, value_parser = value_parser!(bool), default_missing_value = "true", default_value = "false")] errors: bool, /// Include only XML and binary member names that match. Without any member diff --git a/rust/pspp/src/show_spv.rs b/rust/pspp/src/show_spv.rs index fafe045eac..c2a0fd94b6 100644 --- a/rust/pspp/src/show_spv.rs +++ b/rust/pspp/src/show_spv.rs @@ -77,7 +77,7 @@ impl ShowSpv { match self.mode { Mode::Directory => { let item = Item::from_spv_file(&self.input)?.0; - //let item = self.criteria.apply(item); + let item = self.criteria.apply(item); for child in item.details.children() { print_item_directory(&child, 0, self.show_member_names); }