diff options
author | Joris | 2024-11-17 14:23:15 +0100 |
---|---|---|
committer | Joris | 2024-11-17 14:23:15 +0100 |
commit | 0e75ef4efe27535f04b8f5bfc13b2165c3343781 (patch) | |
tree | cdae490293d94b74f45e47c59b4aba57b7316c41 /src | |
parent | 5f526ef14285b5fd2dc5892d6dd8b307981f743f (diff) |
Diffstat (limited to 'src')
-rw-r--r-- | src/cli/mod.rs | 2 | ||||
-rw-r--r-- | src/gui/calendar.rs | 2 | ||||
-rw-r--r-- | src/gui/form/mod.rs | 2 | ||||
-rw-r--r-- | src/gui/form/utils.rs | 2 | ||||
-rw-r--r-- | src/model/event.rs | 2 |
5 files changed, 5 insertions, 5 deletions
diff --git a/src/cli/mod.rs b/src/cli/mod.rs index 2248fde..465d70a 100644 --- a/src/cli/mod.rs +++ b/src/cli/mod.rs @@ -40,7 +40,7 @@ pub fn start_between(conn: &Connection, from: NaiveDateTime, to: NaiveDateTime) dt >= from && dt < to } }) - .map(|e| e.clone()) + .cloned() .collect::<Vec<Event>>(); Ok(format_events(events)) } diff --git a/src/gui/calendar.rs b/src/gui/calendar.rs index 5181116..5a91996 100644 --- a/src/gui/calendar.rs +++ b/src/gui/calendar.rs @@ -193,7 +193,7 @@ pub fn day_entry( fn day_label(today: NaiveDate, date: NaiveDate) -> gtk::Label { let label = gtk::Label::builder() - .label(&format!( + .label(format!( "{} {}", date.day(), if date == today || date.day() == 1 { diff --git a/src/gui/form/mod.rs b/src/gui/form/mod.rs index e05bb78..197bc14 100644 --- a/src/gui/form/mod.rs +++ b/src/gui/form/mod.rs @@ -186,7 +186,7 @@ pub async fn show(app: &App, target: Target) { .collect::<Vec<&str>>(), ); category_dropdown.set_margin_bottom(10); - let selected = get_selected_category(&event, &app.categories).unwrap_or_else(|| "".to_string()); + let selected = get_selected_category(&event, &app.categories).unwrap_or_default(); category_dropdown.set_selected( dropdown_categories .iter() diff --git a/src/gui/form/utils.rs b/src/gui/form/utils.rs index 5cf59e3..d0b4806 100644 --- a/src/gui/form/utils.rs +++ b/src/gui/form/utils.rs @@ -5,7 +5,7 @@ use chrono::NaiveTime; use crate::model::time; pub fn time_entry(time: Option<NaiveTime>) -> gtk::Entry { - entry(&time.map(time::pprint).unwrap_or_else(|| "".to_string())) + entry(&time.map(time::pprint).unwrap_or_default()) } pub fn entry(text: &str) -> gtk::Entry { diff --git a/src/model/event.rs b/src/model/event.rs index 3e5cc76..98ce416 100644 --- a/src/model/event.rs +++ b/src/model/event.rs @@ -53,7 +53,7 @@ pub fn repetitions_between( for event in events { if let Some(repetition) = &event.repetition { for date in repetition.between(event.date, start, end) { - res.entry(date).or_insert_with(Vec::new).push(event.clone()) + res.entry(date).or_default().push(event.clone()) } } } |