Skip to content

Commit

Permalink
clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
hacknus committed Dec 6, 2024
1 parent 593a5ef commit 0e3bd3b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/file_dialog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2567,7 +2567,7 @@ impl FileDialog {
// Calc available width for the file name and include a small margin
let available_width = ui.available_width() - 10.0;

let text = Self::truncate_date(ui, &created, available_width);
let text = Self::truncate_date(ui, created, available_width);

ui.add(egui::Label::new(text).selectable(false));
} else {
Expand All @@ -2580,7 +2580,7 @@ impl FileDialog {
// Calc available width for the file name and include a small margin
let available_width = ui.available_width() - 10.0;

let text = Self::truncate_date(ui, &last_modified, available_width);
let text = Self::truncate_date(ui, last_modified, available_width);

ui.add(egui::Label::new(text).selectable(false));
} else {
Expand Down Expand Up @@ -2741,8 +2741,8 @@ impl FileDialog {
width
}

fn truncate_date(ui: &egui::Ui, date: &SystemTime, max_length: f32) -> String {
let date: DateTime<Local> = (*date).into();
fn truncate_date(ui: &egui::Ui, date: SystemTime, max_length: f32) -> String {
let date: DateTime<Local> = date.into();
let today = Local::now().date_naive(); // NaiveDate for today
let yesterday = today.pred_opt().map_or(today, |day| day); // NaiveDate for yesterday

Expand Down

0 comments on commit 0e3bd3b

Please sign in to comment.