From 48747e3b7c542c696003f71ef4b4ae457934e57c Mon Sep 17 00:00:00 2001 From: Conrad Ludgate Date: Thu, 21 Apr 2022 08:05:57 +0100 Subject: A few minor tweaks (#314) * use bail macro replace client database errors remove dead code * fix test --- src/command/stats.rs | 4 ++-- src/main.rs | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/command/stats.rs b/src/command/stats.rs index d7bddc82..6d342c19 100644 --- a/src/command/stats.rs +++ b/src/command/stats.rs @@ -6,7 +6,7 @@ use chrono_english::parse_date_string; use clap::Parser; use cli_table::{format::Justify, print_stdout, Cell, Style, Table}; -use eyre::{eyre, Result}; +use eyre::{bail, Result}; use atuin_client::database::Database; use atuin_client::history::History; @@ -32,7 +32,7 @@ fn compute_stats(history: &[History]) -> Result<()> { let most_common_command = commands.iter().max_by(|a, b| a.1.cmp(b.1)); if most_common_command.is_none() { - return Err(eyre!("No commands found")); + bail!("No commands found"); } let table = vec![ diff --git a/src/main.rs b/src/main.rs index d5a1e823..2fee879b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -9,7 +9,6 @@ use eyre::Result; extern crate log; use command::AtuinCmd; - mod command; const VERSION: &str = env!("CARGO_PKG_VERSION"); -- cgit v1.3.1