From: Ben Pfaff Date: Sun, 6 Apr 2025 22:58:23 +0000 (-0700) Subject: label_depth for a leaf is always 1 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9640739a2d976d5cc7fc556b7b695e2077c52f4e;p=pspp label_depth for a leaf is always 1 --- diff --git a/rust/pspp/src/output/pivot/mod.rs b/rust/pspp/src/output/pivot/mod.rs index 6cdb9d7b7e..7ce93dab3f 100644 --- a/rust/pspp/src/output/pivot/mod.rs +++ b/rust/pspp/src/output/pivot/mod.rs @@ -528,7 +528,6 @@ pub enum CategoryBuilder { Leaf { name: Box, class: Option, - label_depth: usize, extra_depth: usize, }, } @@ -553,13 +552,11 @@ impl CategoryBuilder { Self::Leaf { name, class, - label_depth, extra_depth, } => { let leaf = Arc::new(Leaf { parent, name, - label_depth, extra_depth, class, }); @@ -571,9 +568,7 @@ impl CategoryBuilder { fn assign_label_depth(&mut self, label_position: LabelPosition) { match self { CategoryBuilder::Group(group) => group.assign_label_depth(label_position, false), - CategoryBuilder::Leaf { label_depth, .. } => { - *label_depth = 1; - } + CategoryBuilder::Leaf { .. } => (), } } fn distribute_extra_depth(&mut self, extra: usize) { @@ -585,13 +580,13 @@ impl CategoryBuilder { fn label_depth(&self) -> usize { match self { CategoryBuilder::Group(group) => group.label_depth, - CategoryBuilder::Leaf { label_depth, .. } => *label_depth, + CategoryBuilder::Leaf { .. } => 1, } } fn set_label_depth(&mut self, depth: usize) { match self { CategoryBuilder::Group(group) => group.label_depth = depth, - CategoryBuilder::Leaf { label_depth, .. } => *label_depth = depth, + CategoryBuilder::Leaf { .. } => (), } } } @@ -607,7 +602,6 @@ impl From for CategoryBuilder { Self::Leaf { name: Box::new(name), class: None, - label_depth: 0, extra_depth: 0, } } @@ -618,7 +612,6 @@ impl From<(Value, Class)> for CategoryBuilder { Self::Leaf { name: Box::new(name), class: Some(class), - label_depth: 0, extra_depth: 0, } } @@ -679,7 +672,6 @@ impl PivotTableBuilder { pub struct Leaf { parent: Weak, name: Box, - label_depth: usize, extra_depth: usize, /// Default format for values in this category. @@ -691,7 +683,6 @@ impl Leaf { Self { parent: Weak::new(), name: Box::new(name), - label_depth: 0, extra_depth: 0, class: None, } @@ -788,7 +779,7 @@ impl CategoryTrait for Leaf { } fn label_depth(&self) -> usize { - self.label_depth + 1 } fn extra_depth(&self) -> usize {