diff options
| author | Nathan Reiner <nathan@nathanreiner.xyz> | 2024-08-10 19:26:52 +0200 |
|---|---|---|
| committer | Nathan Reiner <nathan@nathanreiner.xyz> | 2024-08-10 19:26:52 +0200 |
| commit | f4c019a200f548fcf28be5c8557572ab78a1e2e8 (patch) | |
| tree | 44a23ca87f4e47248c3f59ad7382e8e0547bb832 /src/sheet/loader | |
| parent | 5ff507db2f6667a0305e2382037710f6082d75da (diff) | |
code cleanup
Diffstat (limited to 'src/sheet/loader')
| -rw-r--r-- | src/sheet/loader/mod.rs | 4 | ||||
| -rw-r--r-- | src/sheet/loader/native/csv.rs | 6 |
2 files changed, 4 insertions, 6 deletions
diff --git a/src/sheet/loader/mod.rs b/src/sheet/loader/mod.rs index 0e083fe..6f731db 100644 --- a/src/sheet/loader/mod.rs +++ b/src/sheet/loader/mod.rs @@ -35,7 +35,7 @@ impl Loader { }; } - return None; + None } pub fn add(&mut self, extension: String, func: Box<dyn Runnable<String, Tablized>>) { @@ -43,7 +43,7 @@ impl Loader { } pub fn get() -> &'static mut Self { - static mut GLOBAL_LOADER: Lazy<Loader> = Lazy::new(|| Loader::new()); + static mut GLOBAL_LOADER: Lazy<Loader> = Lazy::new(Loader::new); unsafe { &mut *addr_of_mut!(GLOBAL_LOADER) } } } diff --git a/src/sheet/loader/native/csv.rs b/src/sheet/loader/native/csv.rs index 4a8f05d..6f81645 100644 --- a/src/sheet/loader/native/csv.rs +++ b/src/sheet/loader/native/csv.rs @@ -9,10 +9,8 @@ pub fn load_csv(path: String) -> Tablized { let mut table = Vec::new(); - for result in csv_reader.records() { - if let Ok(record) = result { - table.push(record.iter().map(|s| Cell::from(s)).collect::<Vec<Cell>>()) - } + for record in csv_reader.records().flatten() { + table.push(record.iter().map(Cell::from).collect::<Vec<Cell>>()) } Tablized::Vector(table) |