chore: clippy + fmt
This commit is contained in:
@ -175,7 +175,9 @@ fn import_headless(
|
|||||||
model_name: Option<&str>,
|
model_name: Option<&str>,
|
||||||
array_path: Option<&str>,
|
array_path: Option<&str>,
|
||||||
) -> CommandResult {
|
) -> CommandResult {
|
||||||
let is_csv = path.extension().is_some_and(|ext| ext.eq_ignore_ascii_case("csv"));
|
let is_csv = path
|
||||||
|
.extension()
|
||||||
|
.is_some_and(|ext| ext.eq_ignore_ascii_case("csv"));
|
||||||
|
|
||||||
let records = if is_csv {
|
let records = if is_csv {
|
||||||
// Parse CSV file
|
// Parse CSV file
|
||||||
|
|||||||
@ -26,7 +26,6 @@ use crate::ui::import_wizard_ui::ImportWizardWidget;
|
|||||||
use crate::ui::tile_bar::TileBar;
|
use crate::ui::tile_bar::TileBar;
|
||||||
use crate::ui::view_panel::ViewPanel;
|
use crate::ui::view_panel::ViewPanel;
|
||||||
|
|
||||||
|
|
||||||
struct TuiContext<'a> {
|
struct TuiContext<'a> {
|
||||||
terminal: Terminal<CrosstermBackend<&'a mut Stdout>>,
|
terminal: Terminal<CrosstermBackend<&'a mut Stdout>>,
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,7 +16,7 @@ pub fn parse_formula(raw: &str, target_category: &str) -> Result<Formula> {
|
|||||||
|
|
||||||
// Check for WHERE clause at top level
|
// Check for WHERE clause at top level
|
||||||
let (expr_str, filter) = split_where(rest);
|
let (expr_str, filter) = split_where(rest);
|
||||||
let filter = filter.map(|w| parse_where(w)).transpose()?;
|
let filter = filter.map(parse_where).transpose()?;
|
||||||
|
|
||||||
let expr = parse_expr(expr_str.trim())?;
|
let expr = parse_expr(expr_str.trim())?;
|
||||||
|
|
||||||
@ -299,7 +299,7 @@ fn parse_primary(tokens: &[Token], pos: &mut usize) -> Result<Expr> {
|
|||||||
// Optional WHERE filter
|
// Optional WHERE filter
|
||||||
let filter = if *pos < tokens.len() {
|
let filter = if *pos < tokens.len() {
|
||||||
if let Token::Ident(kw) = &tokens[*pos] {
|
if let Token::Ident(kw) = &tokens[*pos] {
|
||||||
if kw.to_ascii_uppercase() == "WHERE" {
|
if kw.eq_ignore_ascii_case("WHERE") {
|
||||||
*pos += 1;
|
*pos += 1;
|
||||||
let cat = match &tokens[*pos] {
|
let cat = match &tokens[*pos] {
|
||||||
Token::Ident(s) => {
|
Token::Ident(s) => {
|
||||||
|
|||||||
13
src/main.rs
13
src/main.rs
@ -1,18 +1,18 @@
|
|||||||
mod command;
|
mod command;
|
||||||
|
mod draw;
|
||||||
mod formula;
|
mod formula;
|
||||||
mod import;
|
mod import;
|
||||||
mod model;
|
mod model;
|
||||||
mod persistence;
|
mod persistence;
|
||||||
mod ui;
|
mod ui;
|
||||||
mod view;
|
mod view;
|
||||||
mod draw;
|
|
||||||
|
|
||||||
use std::path::PathBuf;
|
use std::path::{Path, PathBuf};
|
||||||
|
|
||||||
use anyhow::{Context, Result};
|
use anyhow::{Context, Result};
|
||||||
|
|
||||||
use model::Model;
|
|
||||||
use draw::run_tui;
|
use draw::run_tui;
|
||||||
|
use model::Model;
|
||||||
use serde_json::Value;
|
use serde_json::Value;
|
||||||
|
|
||||||
fn main() -> Result<()> {
|
fn main() -> Result<()> {
|
||||||
@ -42,8 +42,9 @@ impl Runnable for CmdLineArgs {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn csv_path_p(path:&PathBuf) -> bool {
|
fn csv_path_p(path: &Path) -> bool {
|
||||||
path.extension().is_some_and(|ext| ext.eq_ignore_ascii_case("csv"))
|
path.extension()
|
||||||
|
.is_some_and(|ext| ext.eq_ignore_ascii_case("csv"))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_import_data(path: PathBuf) -> Option<Value> {
|
fn get_import_data(path: PathBuf) -> Option<Value> {
|
||||||
@ -115,7 +116,7 @@ impl Runnable for HeadlessArgs {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if let Some(path) = self.file_path {
|
if let Some(path) = self.file_path {
|
||||||
persistence::save(&mut model, &path)?;
|
persistence::save(&model, &path)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::process::exit(exit_code);
|
std::process::exit(exit_code);
|
||||||
|
|||||||
@ -223,7 +223,7 @@ fn expand_category(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Skip the data item if its group is collapsed.
|
// Skip the data item if its group is collapsed.
|
||||||
if item_group.map_or(false, |g| view.is_group_collapsed(cat_name, g)) {
|
if item_group.is_some_and(|g| view.is_group_collapsed(cat_name, g)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user