Skip to content

Commit

Permalink
Merge pull request #271 from hamirmahal/style/simplify-some-statement…
Browse files Browse the repository at this point in the history
…s-for-readability

style: simplify some statements for readability
  • Loading branch information
Byron authored Dec 13, 2024
2 parents 8933be4 + 0a4d09e commit 3bc25bd
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 9 deletions.
6 changes: 2 additions & 4 deletions src/interactive/app/handlers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -244,8 +244,7 @@ impl AppState {
match self.delete_entry(entry_to_delete, tree_view) {
Ok(ed) => {
entries_deleted += ed;
self.message =
Some(format!("Deleted {} items...", entries_deleted));
self.message = Some(format!("Deleted {entries_deleted} items..."));
Ok(pane)
}
Err(c) => Err((pane, c)),
Expand All @@ -265,8 +264,7 @@ impl AppState {
match self.trash_entry(entry_to_trash, tree_view) {
Ok(ed) => {
entries_trashed += ed;
self.message =
Some(format!("Trashed {} items...", entries_trashed));
self.message = Some(format!("Trashed {entries_trashed} items..."));
Ok(pane)
}
Err(c) => Err((pane, c)),
Expand Down
2 changes: 1 addition & 1 deletion src/interactive/app/tests/journeys_readonly.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ fn simple_user_journey_read_only() -> Result<()> {
"it will not think it is still scanning as there is no traversal"
);

let first_selected_path = OsString::from(format!("{}/{}", FIXTURE_PATH, long_root));
let first_selected_path = OsString::from(format!("{FIXTURE_PATH}/{long_root}"));
assert_eq!(
node_by_name(&app, &first_selected_path).name,
first_selected_path,
Expand Down
2 changes: 1 addition & 1 deletion src/interactive/app/tests/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -333,5 +333,5 @@ pub fn make_add_node(
}

pub fn debug(item: impl fmt::Debug) -> String {
format!("{:?}", item)
format!("{item:?}")
}
2 changes: 1 addition & 1 deletion src/interactive/widgets/entries.rs
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ fn columns_with_separators(
fn mtime_column(entry_mtime: SystemTime, style: Style) -> Span<'static> {
let datetime = DateTime::<chrono::Utc>::from(entry_mtime);
let formatted_time = datetime.format("%d/%m/%Y %H:%M:%S").to_string();
Span::styled(format!("{:>20}", formatted_time), style)
Span::styled(format!("{formatted_time:>20}"), style)
}

fn count_column(entry_count: Option<u64>, style: Style) -> Span<'static> {
Expand Down
2 changes: 1 addition & 1 deletion src/interactive/widgets/help.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ impl HelpPane {
..Default::default()
},
),
Span::from(format!(" => {}", description)),
Span::from(format!(" => {description}")),
]));
if let Some(second_line) = other_line {
lines.borrow_mut().push(Line::from(Span::from(format!(
Expand Down
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ fn main() -> Result<()> {
extract_paths_maybe_set_cwd(input, !opt.stay_on_filesystem)?,
)?;
if statistics {
writeln!(io::stderr(), "{:?}", stats).ok();
writeln!(io::stderr(), "{stats:?}").ok();
}
res
}
Expand Down

0 comments on commit 3bc25bd

Please sign in to comment.