From 972a590ba9285251add86ba8d63b2d79f16cbeb3 Mon Sep 17 00:00:00 2001 From: Joscha Date: Mon, 2 May 2022 12:57:21 +0200 Subject: [PATCH] Satisfy clippy --- src/cli/layout/day.rs | 4 ++-- src/cli/layout/line.rs | 4 +--- src/files/format.rs | 2 +- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/cli/layout/day.rs b/src/cli/layout/day.rs index e0f2d17..044269c 100644 --- a/src/cli/layout/day.rs +++ b/src/cli/layout/day.rs @@ -189,7 +189,7 @@ impl DayLayout { } } - fn sort_entries(entries: &mut Vec<(usize, &Entry)>) { + fn sort_entries(entries: &mut [(usize, &Entry)]) { // Entries should be sorted by these factors, in descending order of // significance: // 1. Their start date, if any @@ -219,7 +219,7 @@ impl DayLayout { entries.sort_by_key(|(_, e)| e.dates.map(|d| d.sorted().root_with_time())); } - fn sort_day(day: &mut Vec) { + fn sort_day(day: &mut [DayEntry]) { // In a day, entries should be sorted into these categories: // 1. Untimed entries that end at the current day // 2. Timed entries, based on diff --git a/src/cli/layout/line.rs b/src/cli/layout/line.rs index a63d45e..42cd871 100644 --- a/src/cli/layout/line.rs +++ b/src/cli/layout/line.rs @@ -174,9 +174,7 @@ impl LineLayout { self.line_entry(entries, *i, today, Times::At(*t), None); } DayEntry::TimedAt(i, t, t2) => { - let time = t2 - .map(|t2| Times::FromTo(*t, t2)) - .unwrap_or_else(|| Times::At(*t)); + let time = t2.map(|t2| Times::FromTo(*t, t2)).unwrap_or(Times::At(*t)); self.line_entry(entries, *i, today, time, None); } DayEntry::TimedStart(i, t) => { diff --git a/src/files/format.rs b/src/files/format.rs index 5f2ec3f..caa5d9b 100644 --- a/src/files/format.rs +++ b/src/files/format.rs @@ -319,7 +319,7 @@ impl fmt::Display for Command { } impl File { - fn sort(commands: &mut Vec<&Command>) { + fn sort(commands: &mut [&Command]) { // Order of commands in a file: // 1. Imports, sorted alphabetically // 2. Time zone(s)