diff options
| author | 魏曹先生 <1992414357@qq.com> | 2026-04-17 09:45:13 +0800 |
|---|---|---|
| committer | 魏曹先生 <1992414357@qq.com> | 2026-04-17 09:45:13 +0800 |
| commit | 497a667f49c8dea870a8a61ddabd95e24765a80d (patch) | |
| tree | 84bed9d9b604af593b1031ae62ca7b3fec4d7112 /src/cli.rs | |
| parent | 5e7d1968e94bf39d369de0e6ef98cf383cfd3d6f (diff) | |
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
Diffstat (limited to 'src/cli.rs')
| -rw-r--r-- | src/cli.rs | 7 |
1 files changed, 2 insertions, 5 deletions
@@ -122,7 +122,7 @@ fn name_suggest(typed: Vec<String>) -> 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 { |
