From: Ben Pfaff Date: Sun, 5 Jan 2025 16:29:28 +0000 (-0800) Subject: remove csv crate X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2a7e64cb93e5c9873cc46170ee4103599a8e9771;p=pspp remove csv crate --- diff --git a/rust/pspp/src/output/csv.rs b/rust/pspp/src/output/csv.rs index 61157b8385..93c45b5338 100644 --- a/rust/pspp/src/output/csv.rs +++ b/rust/pspp/src/output/csv.rs @@ -1,4 +1,4 @@ -use std::{borrow::Cow, fmt::Display, fs::File, io::Write, sync::Arc}; +use std::{borrow::Cow, fmt::Display, fs::File, io::{Error, Write}, sync::Arc}; use crate::output::pivot::Coord2; @@ -82,7 +82,7 @@ impl CsvDriver { self.n_items += 1; } - fn output_table_layer(&mut self, pt: &PivotTable, layer: &[usize]) -> Result<(), csv::Error> { + fn output_table_layer(&mut self, pt: &PivotTable, layer: &[usize]) -> Result<(), Error> { let output = pt.output(layer, true); self.start_item(); @@ -99,7 +99,7 @@ impl CsvDriver { pivot_table: &PivotTable, table: Option<&Table>, leader: Option<&str>, - ) -> Result<(), csv::Error> { + ) -> Result<(), Error> { let Some(table) = table else { return Ok(()); }; @@ -107,7 +107,7 @@ impl CsvDriver { for y in 0..table.n.y() { for x in 0..table.n.x() { if x > 0 { - write!(&mut self.file, "{}", self.options.delimiter as char).unwrap(); + write!(&mut self.file, "{}", self.options.delimiter as char)?; } let coord = Coord2::new(x, y); @@ -119,11 +119,11 @@ impl CsvDriver { Some(leader) if x == 0 && y == 0 => format!("{leader}: {display}"), _ => display.to_string(), }; - write!(&mut self.file, "{}", CsvField::new(&s, self.options)).unwrap(); + write!(&mut self.file, "{}", CsvField::new(&s, self.options))?; } } } - writeln!(&mut self.file).unwrap(); + writeln!(&mut self.file)?; } Ok(()) diff --git a/rust/pspp/src/output/pivot/mod.rs b/rust/pspp/src/output/pivot/mod.rs index 11a1c22b32..03d4331d63 100644 --- a/rust/pspp/src/output/pivot/mod.rs +++ b/rust/pspp/src/output/pivot/mod.rs @@ -238,7 +238,7 @@ impl Axis3 { #[derive(Clone, Debug, Default)] pub struct Axis { /// `dimensions[0]` is the innermost dimension. - dimensions: Vec, + dimensions: Vec>, /// The number of rows or columns along the axis, that is, the product of /// `dimensions[*].len()`. It is 0 if any dimension has 0 leaves. @@ -859,7 +859,7 @@ pub struct PivotTable { corner_text: Option, caption: Option, notes: Option, - dimensions: Vec, + dimensions: Vec>, axes: EnumMap, cells: HashMap, } diff --git a/rust/pspp/src/output/pivot/output.rs b/rust/pspp/src/output/pivot/output.rs index 0b2d42806e..59bc362074 100644 --- a/rust/pspp/src/output/pivot/output.rs +++ b/rust/pspp/src/output/pivot/output.rs @@ -295,7 +295,7 @@ impl PivotTable { } } - fn nonempty_layer_dimensions(&self) -> impl Iterator { + fn nonempty_layer_dimensions(&self) -> impl Iterator> { self.axes[Axis3::Z] .dimensions .iter()