chore: cleanup unused code and impoorts

This commit is contained in:
Jeremy Wall 2024-10-30 13:46:52 -04:00
parent 43956ac0eb
commit 68469c9afd

View File

@ -2,7 +2,7 @@
use std::{fs::File, io::Read, path::PathBuf}; use std::{fs::File, io::Read, path::PathBuf};
use super::sheet::{Address, CellValue, Tbl}; use super::sheet::Tbl;
use anyhow::{Context, Result}; use anyhow::{Context, Result};
use ratatui::{ use ratatui::{
@ -53,26 +53,6 @@ impl Widget for Workspace {
} }
} }
fn generate_default_table<'a>() -> Tbl {
let mut tbl = Tbl::new();
tbl.update_entry(Address::new(3, 3), CellValue::text("3,3"))
.context("Failed updating entry at 5,5")
.expect("Unexpected fail to update entry");
tbl.update_entry(Address::new(6, 6), CellValue::float(6.6))
.context("Failed updating entry at 10,10")
.expect("Unexpected fail to update entry");
tbl.update_entry(Address::new(0, 0), CellValue::formula("0.0"))
.context("Failed updating entry at 0,0")
.expect("Unexpected fail to update entry");
tbl.update_entry(Address::new(1, 0), CellValue::formula("1.0"))
.context("Failed updating entry at 0,0")
.expect("Unexpected fail to update entry");
tbl.update_entry(Address::new(2, 0), CellValue::formula("2.0"))
.context("Failed updating entry at 0,0")
.expect("Unexpected fail to update entry");
tbl
}
const COLNAMES: [&'static str; 27] = [ const COLNAMES: [&'static str; 27] = [
"", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R",
"S", "T", "U", "V", "W", "X", "Y", "Z", "S", "T", "U", "V", "W", "X", "Y", "Z",
@ -124,7 +104,6 @@ impl<'t> From<&Tbl> for Table<'t> {
} }
pub fn draw(frame: &mut Frame, name: &PathBuf) { pub fn draw(frame: &mut Frame, name: &PathBuf) {
let table = generate_default_table();
let ws = Workspace::load(name).unwrap(); let ws = Workspace::load(name).unwrap();
frame.render_widget(ws, frame.area()); frame.render_widget(ws, frame.area());