Fix clippy lints

This commit is contained in:
2026-03-21 22:30:05 +01:00
parent 0287561e2f
commit 17f7690789
2 changed files with 7 additions and 10 deletions
+3 -4
View File
@@ -20,14 +20,13 @@ pub use fs::*;
mod fs {
use super::Config;
use anyhow::{Context, Ok};
use serde_json;
const CONFIG_FILE_NAME: &'static str = "config.json";
const XDG_PREFIX: &'static str = "inköpslista";
const CONFIG_FILE_NAME: &str = "config.json";
const XDG_PREFIX: &str = "inköpslista";
pub fn save_config(address: String) -> Result<(), anyhow::Error> {
let xdg_dirs = xdg::BaseDirectories::with_prefix(XDG_PREFIX);
let conf = Config { address: address };
let conf = Config { address };
let conf = serde_json::to_string(&conf).context("unable to serialize config")?;
let path = xdg_dirs
+4 -6
View File
@@ -80,7 +80,7 @@ fn refresh_list(conf: &Arc<Mutex<Config>>, app_weak: &slint::Weak<App>) {
let _ = app_weak.upgrade_in_event_loop(|app| {
let list: ModelRc<SItem> = app.global::<State>().get_list();
let list: &VecModel<SItem> = list.as_any().downcast_ref().expect("list is a VecModel");
update_slint_list(new_list, &list);
update_slint_list(new_list, list);
});
});
}
@@ -125,7 +125,7 @@ pub fn run() -> Result<(), anyhow::Error> {
state.on_add_to_list(move |item| {
if let Some(index) = list.iter().position(|item2| item2.name == item) {
let mut item2 = list.row_data(index).unwrap();
item2.amount = item2.amount + 1;
item2.amount += 1;
let item3 = item2.clone();
list.set_row_data(index, item2);
let conf = conf.clone();
@@ -229,7 +229,7 @@ pub fn run() -> Result<(), anyhow::Error> {
state.on_inc_amount(move |item| {
if let Some(index) = list.iter().position(|item2| item2.name == item) {
let mut item2 = list.row_data(index).unwrap();
item2.amount = item2.amount + 1;
item2.amount += 1;
let item3 = item2.clone();
list.set_row_data(index, item2);
let conf = conf.clone();
@@ -247,7 +247,6 @@ pub fn run() -> Result<(), anyhow::Error> {
eprintln!("{err:?}");
}
});
return;
}
});
@@ -256,7 +255,7 @@ pub fn run() -> Result<(), anyhow::Error> {
state.on_dec_amount(move |item| {
if let Some(index) = list.iter().position(|item2| item2.name == item) {
let mut item2 = list.row_data(index).unwrap();
item2.amount = item2.amount - 1;
item2.amount -= 1;
let item3 = item2.clone();
list.set_row_data(index, item2);
let conf = conf.clone();
@@ -284,7 +283,6 @@ pub fn run() -> Result<(), anyhow::Error> {
eprintln!("{err:?}");
}
});
return;
}
}
});