From 497a667f49c8dea870a8a61ddabd95e24765a80d Mon Sep 17 00:00:00 2001 From: 魏曹先生 <1992414357@qq.com> Date: Fri, 17 Apr 2026 09:45:13 +0800 Subject: Apply clippy suggestions - Use `BTreeMap::entry` API in `update_item` - Replace `or_insert_with(Vec::new)` with `or_default` - Iterate over map values instead of key-value pairs - Use `std::io::Error::other` for custom errors - Simplify filter logic with direct predicate - Replace manual `Into` implementation with `From` - Remove unnecessary explicit returns --- src/cli.rs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'src/cli.rs') diff --git a/src/cli.rs b/src/cli.rs index 44c1f8f..9c17ebb 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -122,7 +122,7 @@ fn name_suggest(typed: Vec) -> Suggest { suggest.insert(SuggestItem::Simple(member)); } } - return suggest; + suggest } #[completion(ListAllBillEntry)] @@ -353,10 +353,7 @@ fn read_bills() -> Bills { let state_file = state_file_path(); if state_file.exists() { match std::fs::read_to_string(&state_file) { - Ok(contents) => match serde_yaml::from_str(&contents) { - Ok(bills) => bills, - Err(_) => Bills::default(), - }, + Ok(contents) => serde_yaml::from_str(&contents).unwrap_or_default(), Err(_) => Bills::default(), } } else { -- cgit