style: reformat code and cleanup whitespace

Reformat code for improved readability and remove unnecessary whitespace.

Co-Authored-By: fiddlerwoaroof/git-smart-commit (gemma-4-26B-A4B-it-UD-Q5_K_XL.gguf)
This commit is contained in:
Edward Langley
2026-04-15 23:42:44 -07:00
parent a900f147b5
commit 4e37e12f9a
6 changed files with 21 additions and 24 deletions

View File

@ -138,7 +138,6 @@ impl Workbook {
view.col_offset = 0;
}
}
}
#[cfg(test)]

View File

@ -246,8 +246,11 @@ fn draw_content(f: &mut Frame, area: Rect, app: &App) {
}
if app.category_panel_open {
let a = Rect::new(side.x, y, side.width, ph);
let content =
CategoryContent::new(&app.workbook.model, app.workbook.active_view(), &app.expanded_cats);
let content = CategoryContent::new(
&app.workbook.model,
app.workbook.active_view(),
&app.expanded_cats,
);
f.render_widget(Panel::new(content, &app.mode, app.cat_panel_cursor), a);
y += ph;
}

View File

@ -222,7 +222,8 @@ impl ImportPipeline {
if let Some(val) = map.get(&measure.field).and_then(|v| v.as_f64()) {
let mut cell_coords = coords.clone();
cell_coords.push(("_Measure".to_string(), measure.field.clone()));
wb.model.set_cell(CellKey::new(cell_coords), CellValue::Number(val));
wb.model
.set_cell(CellKey::new(cell_coords), CellValue::Number(val));
}
}
}
@ -1112,6 +1113,9 @@ mod tests {
("Date_Month".to_string(), "2026-03".to_string()),
("_Measure".to_string(), "Amount".to_string()),
]);
assert_eq!(wb.model.get_cell(&key).and_then(|v| v.as_f64()), Some(100.0));
assert_eq!(
wb.model.get_cell(&key).and_then(|v| v.as_f64()),
Some(100.0)
);
}
}

View File

@ -578,11 +578,7 @@ fn coord_str(key: &CellKey) -> String {
.join(", ")
}
pub fn export_csv(
workbook: &Workbook,
view_name: &str,
path: &Path,
) -> Result<()> {
pub fn export_csv(workbook: &Workbook, view_name: &str, path: &Path) -> Result<()> {
let view = workbook
.views
.get(view_name)
@ -1429,10 +1425,7 @@ Type=Food = 42
fn category_name_with_comma_space_in_data() {
let mut m = Workbook::new("Test");
m.add_category("Income, Gross").unwrap();
m.model
.category_mut("Income, Gross")
.unwrap()
.add_item("A");
m.model.category_mut("Income, Gross").unwrap().add_item("A");
m.add_category("Month").unwrap();
m.model.category_mut("Month").unwrap().add_item("Jan");
m.model.set_cell(
@ -1602,8 +1595,7 @@ mod parser_prop_tests {
for (i, value) in values.into_iter().enumerate() {
let a = &items1[i % items1.len()];
let b = &items2[i % items2.len()];
m.model
.set_cell(coord(&[("CatA", a), ("CatB", b)]), value);
m.model.set_cell(coord(&[("CatA", a), ("CatB", b)]), value);
}
m

View File

@ -915,7 +915,10 @@ mod tests {
fn formula_cell_renders_computed_value() {
let mut m = Workbook::new("Test");
m.add_category("Region").unwrap(); // → Column
m.model.category_mut("_Measure").unwrap().add_item("Revenue");
m.model
.category_mut("_Measure")
.unwrap()
.add_item("Revenue");
m.model.category_mut("_Measure").unwrap().add_item("Cost");
// Profit is a formula target — dynamically included in _Measure
m.model.category_mut("Region").unwrap().add_item("East");
@ -927,7 +930,8 @@ mod tests {
coord(&[("_Measure", "Cost"), ("Region", "East")]),
CellValue::Number(600.0),
);
m.model.add_formula(parse_formula("Profit = Revenue - Cost", "_Measure").unwrap());
m.model
.add_formula(parse_formula("Profit = Revenue - Cost", "_Measure").unwrap());
m.active_view_mut()
.set_axis("_Index", crate::view::Axis::None);
m.active_view_mut()

View File

@ -18,12 +18,7 @@ pub struct TileBar<'a> {
}
impl<'a> TileBar<'a> {
pub fn new(
model: &'a Model,
view: &'a View,
mode: &'a AppMode,
tile_cat_idx: usize,
) -> Self {
pub fn new(model: &'a Model, view: &'a View, mode: &'a AppMode, tile_cat_idx: usize) -> Self {
Self {
model,
view,