From 8b7a997bfd2d89362aa19a8a6b539d1098a4e171 Mon Sep 17 00:00:00 2001 From: extrawurst Date: Wed, 29 Oct 2025 13:37:33 +0100 Subject: [PATCH] cleanup format strings --- asyncgit/src/asyncjob/mod.rs | 2 +- asyncgit/src/blame.rs | 2 +- asyncgit/src/commit_files.rs | 2 +- asyncgit/src/diff.rs | 6 +++--- asyncgit/src/pull.rs | 2 +- asyncgit/src/push.rs | 2 +- asyncgit/src/push_tags.rs | 2 +- asyncgit/src/remote_progress.rs | 3 +-- asyncgit/src/status.rs | 6 ++---- asyncgit/src/sync/remotes/callbacks.rs | 17 +++++------------ asyncgit/src/sync/state.rs | 2 +- src/app.rs | 6 +++--- src/clipboard.rs | 8 ++++---- src/components/status_tree.rs | 1 - src/components/utils/filetree.rs | 2 +- src/input.rs | 2 +- src/main.rs | 2 +- src/options.rs | 2 +- src/popups/commit.rs | 10 +++++----- src/popups/create_branch.rs | 2 +- src/popups/create_remote.rs | 2 +- src/popups/externaleditor.rs | 4 ++-- src/popups/pull.rs | 4 ++-- src/popups/rename_branch.rs | 2 +- src/popups/rename_remote.rs | 2 +- src/popups/tag_commit.rs | 2 +- src/popups/update_remote_url.rs | 2 +- src/tabs/revlog.rs | 2 +- src/ui/style.rs | 12 +++--------- src/ui/syntax_text.rs | 2 +- src/watcher.rs | 4 ++-- 31 files changed, 51 insertions(+), 68 deletions(-) diff --git a/asyncgit/src/asyncjob/mod.rs b/asyncgit/src/asyncjob/mod.rs index 19058f9bac..2f6d31f5f0 100644 --- a/asyncgit/src/asyncjob/mod.rs +++ b/asyncgit/src/asyncjob/mod.rs @@ -130,7 +130,7 @@ impl AsyncSingleJob { let self_clone = (*self).clone(); rayon_core::spawn(move || { if let Err(e) = self_clone.run_job(task) { - log::error!("async job error: {}", e); + log::error!("async job error: {e}"); } }); diff --git a/asyncgit/src/blame.rs b/asyncgit/src/blame.rs index dcbb93aff0..6bf4afe358 100644 --- a/asyncgit/src/blame.rs +++ b/asyncgit/src/blame.rs @@ -116,7 +116,7 @@ impl AsyncBlame { let notify = match notify { Err(err) => { - log::error!("get_blame_helper error: {}", err); + log::error!("get_blame_helper error: {err}"); true } Ok(notify) => notify, diff --git a/asyncgit/src/commit_files.rs b/asyncgit/src/commit_files.rs index b2c3da1ec9..a1945b55f8 100644 --- a/asyncgit/src/commit_files.rs +++ b/asyncgit/src/commit_files.rs @@ -89,7 +89,7 @@ impl AsyncCommitFiles { return Ok(()); } - log::trace!("request: {:?}", params); + log::trace!("request: {params:?}"); { let current = self.current.lock()?; diff --git a/asyncgit/src/diff.rs b/asyncgit/src/diff.rs index 5316e67b2b..b9f62e557f 100644 --- a/asyncgit/src/diff.rs +++ b/asyncgit/src/diff.rs @@ -98,7 +98,7 @@ impl AsyncDiff { &self, params: DiffParams, ) -> Result> { - log::trace!("request {:?}", params); + log::trace!("request {params:?}"); let hash = hash(¶ms); @@ -131,8 +131,8 @@ impl AsyncDiff { ); let notify = match notify { - Err(err) => { - log::error!("get_diff_helper error: {}", err); + Err(e) => { + log::error!("get_diff_helper error: {e}"); true } Ok(notify) => notify, diff --git a/asyncgit/src/pull.rs b/asyncgit/src/pull.rs index 3ba88d6091..90a146b8c8 100644 --- a/asyncgit/src/pull.rs +++ b/asyncgit/src/pull.rs @@ -153,7 +153,7 @@ impl AsyncPull { *last_res = match res { Ok(bytes) => Some((bytes, String::new())), Err(e) => { - log::error!("fetch error: {}", e); + log::error!("fetch error: {e}"); Some((0, e.to_string())) } }; diff --git a/asyncgit/src/push.rs b/asyncgit/src/push.rs index e969689292..867ecd8d67 100644 --- a/asyncgit/src/push.rs +++ b/asyncgit/src/push.rs @@ -164,7 +164,7 @@ impl AsyncPush { *last_res = match res { Ok(()) => None, Err(e) => { - log::error!("push error: {}", e); + log::error!("push error: {e}",); Some(e.to_string()) } }; diff --git a/asyncgit/src/push_tags.rs b/asyncgit/src/push_tags.rs index 0984e2ae23..a294a51060 100644 --- a/asyncgit/src/push_tags.rs +++ b/asyncgit/src/push_tags.rs @@ -147,7 +147,7 @@ impl AsyncPushTags { *last_res = match res { Ok(()) => None, Err(e) => { - log::error!("push error: {}", e); + log::error!("push error: {e}"); Some(e.to_string()) } }; diff --git a/asyncgit/src/remote_progress.rs b/asyncgit/src/remote_progress.rs index 2e84f6bd8b..e869954db9 100644 --- a/asyncgit/src/remote_progress.rs +++ b/asyncgit/src/remote_progress.rs @@ -96,8 +96,7 @@ impl RemoteProgress { } Err(e) => { log::error!( - "remote progress receiver error: {}", - e + "remote progress receiver error: {e}", ); break; } diff --git a/asyncgit/src/status.rs b/asyncgit/src/status.rs index 52f57fb9ff..749272fe00 100644 --- a/asyncgit/src/status.rs +++ b/asyncgit/src/status.rs @@ -135,7 +135,7 @@ impl AsyncStatus { &arc_current, &arc_last, ) { - log::error!("fetch_helper: {}", e); + log::error!("fetch_helper: {e}"); } arc_pending.fetch_sub(1, Ordering::Relaxed); @@ -158,9 +158,7 @@ impl AsyncStatus { ) -> Result<()> { let res = Self::get_status(repo, status_type, config)?; log::trace!( - "status fetched: {} (type: {:?})", - hash_request, - status_type, + "status fetched: {hash_request} (type: {status_type:?})", ); { diff --git a/asyncgit/src/sync/remotes/callbacks.rs b/asyncgit/src/sync/remotes/callbacks.rs index 76e260a8d4..e74b0e4edd 100644 --- a/asyncgit/src/sync/remotes/callbacks.rs +++ b/asyncgit/src/sync/remotes/callbacks.rs @@ -107,11 +107,7 @@ impl Callbacks { reference: &str, msg: Option<&str>, ) { - log::debug!( - "push_update_reference: '{}' {:?}", - reference, - msg - ); + log::debug!("push_update_reference: '{reference}' {msg:?}",); if let Ok(mut stats) = self.stats.lock() { stats.push_rejected_msg = msg @@ -125,7 +121,7 @@ impl Callbacks { total: usize, current: usize, ) { - log::debug!("packing: {:?} - {}/{}", stage, current, total); + log::debug!("packing: {stage:?} - {current}/{total}"); self.sender.clone().map(|sender| { sender.send(ProgressNotification::Packing { stage, @@ -150,7 +146,7 @@ impl Callbacks { } fn update_tips(&self, name: &str, a: git2::Oid, b: git2::Oid) { - log::debug!("update tips: '{}' [{}] [{}]", name, a, b); + log::debug!("update tips: '{name}' [{a}] [{b}]"); self.sender.clone().map(|sender| { sender.send(ProgressNotification::UpdateTips { name: name.to_string(), @@ -166,7 +162,7 @@ impl Callbacks { total: usize, bytes: usize, ) { - log::debug!("progress: {}/{} ({} B)", current, total, bytes,); + log::debug!("progress: {current}/{total} ({bytes} B)",); self.sender.clone().map(|sender| { sender.send(ProgressNotification::PushTransfer { current, @@ -187,10 +183,7 @@ impl Callbacks { allowed_types: git2::CredentialType, ) -> std::result::Result { log::debug!( - "creds: '{}' {:?} ({:?})", - url, - username_from_url, - allowed_types + "creds: '{url}' {username_from_url:?} ({allowed_types:?})", ); // This boolean is used to avoid multiple calls to credentials callback. diff --git a/asyncgit/src/sync/state.rs b/asyncgit/src/sync/state.rs index ffa0918728..2098f839f3 100644 --- a/asyncgit/src/sync/state.rs +++ b/asyncgit/src/sync/state.rs @@ -26,7 +26,7 @@ impl From for RepoState { RepositoryState::Revert => Self::Revert, RepositoryState::RebaseMerge => Self::Rebase, _ => { - log::warn!("state not supported yet: {:?}", state); + log::warn!("state not supported yet: {state:?}"); Self::Other } } diff --git a/src/app.rs b/src/app.rs index 68d2987c6f..479e2868cf 100644 --- a/src/app.rs +++ b/src/app.rs @@ -285,7 +285,7 @@ impl App { /// pub fn event(&mut self, ev: InputEvent) -> Result<()> { - log::trace!("event: {:?}", ev); + log::trace!("event: {ev:?}"); if let InputEvent::Input(ev) = ev { if self.check_hard_exit(&ev) || self.check_quit(&ev) { @@ -402,7 +402,7 @@ impl App { &mut self, ev: AsyncNotification, ) -> Result<()> { - log::trace!("update_async: {:?}", ev); + log::trace!("update_async: {ev:?}"); if let AsyncNotification::Git(ev) = ev { self.status_tab.update_git(ev)?; @@ -1061,7 +1061,7 @@ impl App { )); } Err(e) => { - log::error!("delete remote: {}", e,); + log::error!("delete remote: {e:?}"); self.queue.push(InternalEvent::ShowErrorMsg( format!("delete remote error:\n{e}",), )); diff --git a/src/clipboard.rs b/src/clipboard.rs index 253fdb5953..79373a5b12 100644 --- a/src/clipboard.rs +++ b/src/clipboard.rs @@ -24,18 +24,18 @@ fn exec_copy_with_args( Stdio::null() }) .spawn() - .map_err(|e| anyhow!("`{:?}`: {}", command, e))?; + .map_err(|e| anyhow!("`{command:?}`: {e:?}"))?; process .stdin .as_mut() - .ok_or_else(|| anyhow!("`{:?}`", command))? + .ok_or_else(|| anyhow!("`{command:?}`"))? .write_all(text.as_bytes()) - .map_err(|e| anyhow!("`{:?}`: {}", command, e))?; + .map_err(|e| anyhow!("`{command:?}`: {e:?}"))?; let out = process .wait_with_output() - .map_err(|e| anyhow!("`{:?}`: {}", command, e))?; + .map_err(|e| anyhow!("`{command:?}`: {e:?}"))?; if out.status.success() { Ok(()) diff --git a/src/components/status_tree.rs b/src/components/status_tree.rs index f04224ec09..591152c3b4 100644 --- a/src/components/status_tree.rs +++ b/src/components/status_tree.rs @@ -471,7 +471,6 @@ impl Component for StatusTreeComponent { CommandBlocking::PassingOn } - #[expect(clippy::cognitive_complexity)] fn event(&mut self, ev: &Event) -> Result { if self.focused { if let Event::Key(e) = ev { diff --git a/src/components/utils/filetree.rs b/src/components/utils/filetree.rs index a0b507fa82..1329b9bef8 100644 --- a/src/components/utils/filetree.rs +++ b/src/components/utils/filetree.rs @@ -76,7 +76,7 @@ impl FileTreeItem { ), kind: FileTreeItemKind::File(item.clone()), }), - None => bail!("invalid file name {:?}", item), + None => bail!("invalid file name {item:?}"), } } diff --git a/src/input.rs b/src/input.rs index efe025c61a..701b8b5ac8 100644 --- a/src/input.rs +++ b/src/input.rs @@ -54,7 +54,7 @@ impl Input { if let Err(e) = Self::input_loop(&arc_desired, &arc_current, &tx) { - log::error!("input thread error: {}", e); + log::error!("input thread error: {e}"); arc_aborted.store(true, Ordering::SeqCst); } }); diff --git a/src/main.rs b/src/main.rs index dbcce4e58f..11fd31ff98 100644 --- a/src/main.rs +++ b/src/main.rs @@ -344,7 +344,7 @@ fn draw(terminal: &mut Terminal, app: &App) -> io::Result<()> { terminal.draw(|f| { if let Err(e) = app.draw(f) { - log::error!("failed to draw: {:?}", e); + log::error!("failed to draw: {e:?}"); } })?; diff --git a/src/options.rs b/src/options.rs index 38e7ac1bfe..84063e6970 100644 --- a/src/options.rs +++ b/src/options.rs @@ -139,7 +139,7 @@ impl Options { fn save(&self) { if let Err(e) = self.save_failable() { - log::error!("options save error: {}", e); + log::error!("options save error: {e}"); } } diff --git a/src/popups/commit.rs b/src/popups/commit.rs index 008fc6f8a7..146286f832 100644 --- a/src/popups/commit.rs +++ b/src/popups/commit.rs @@ -240,7 +240,7 @@ impl CommitPopup { if let HookResult::NotOk(e) = sync::hooks_pre_commit(&self.repo.borrow())? { - log::error!("pre-commit hook error: {}", e); + log::error!("pre-commit hook error: {e}"); self.queue.push(InternalEvent::ShowErrorMsg( format!("pre-commit hook error:\n{e}"), )); @@ -256,7 +256,7 @@ impl CommitPopup { if let HookResult::NotOk(e) = sync::hooks_commit_msg(&self.repo.borrow(), &mut msg)? { - log::error!("commit-msg hook error: {}", e); + log::error!("commit-msg hook error: {e}"); self.queue.push(InternalEvent::ShowErrorMsg( format!("commit-msg hook error:\n{e}"), )); @@ -268,7 +268,7 @@ impl CommitPopup { if let HookResult::NotOk(e) = sync::hooks_post_commit(&self.repo.borrow())? { - log::error!("post-commit hook error: {}", e); + log::error!("post-commit hook error: {e}"); self.queue.push(InternalEvent::ShowErrorMsg(format!( "post-commit hook error:\n{e}" ))); @@ -400,7 +400,7 @@ impl CommitPopup { "commit.template", ) .map_err(|e| { - log::error!("load git-config failed: {}", e); + log::error!("load git-config failed: {e}"); e }) .ok() @@ -415,7 +415,7 @@ impl CommitPopup { .and_then(|path| { read_to_string(&path) .map_err(|e| { - log::error!("read commit.template failed: {e} (path: '{:?}')",path); + log::error!("read commit.template failed: {e} (path: '{path:?}')"); e }) .ok() diff --git a/src/popups/create_branch.rs b/src/popups/create_branch.rs index ed69d392ae..bc83031047 100644 --- a/src/popups/create_branch.rs +++ b/src/popups/create_branch.rs @@ -129,7 +129,7 @@ impl CreateBranchPopup { )); } Err(e) => { - log::error!("create branch: {}", e,); + log::error!("create branch: {e}"); self.queue.push(InternalEvent::ShowErrorMsg( format!("create branch error:\n{e}",), )); diff --git a/src/popups/create_remote.rs b/src/popups/create_remote.rs index 8e464931e8..e6a51a925f 100644 --- a/src/popups/create_remote.rs +++ b/src/popups/create_remote.rs @@ -200,7 +200,7 @@ impl CreateRemotePopup { )); } Err(e) => { - log::error!("create remote: {}", e,); + log::error!("create remote: {e}"); self.queue.push(InternalEvent::ShowErrorMsg( format!("create remote error:\n{e}",), )); diff --git a/src/popups/externaleditor.rs b/src/popups/externaleditor.rs index 4f9856e572..52a7327b13 100644 --- a/src/popups/externaleditor.rs +++ b/src/popups/externaleditor.rs @@ -58,7 +58,7 @@ impl ExternalEditorPopup { }; if !path.exists() { - bail!("file not found: {:?}", path); + bail!("file not found: {path:?}"); } io::stdout().execute(LeaveAlternateScreen)?; @@ -113,7 +113,7 @@ impl ExternalEditorPopup { .current_dir(work_dir) .args(args) .status() - .map_err(|e| anyhow!("\"{}\": {}", command, e))?; + .map_err(|e| anyhow!("\"{command}\": {e}"))?; Ok(()) } diff --git a/src/popups/pull.rs b/src/popups/pull.rs index fbe1abda09..b1faaa58df 100644 --- a/src/popups/pull.rs +++ b/src/popups/pull.rs @@ -152,8 +152,8 @@ impl PullPopup { &self.repo.borrow(), &self.branch, ); - if let Err(err) = ff_res { - log::trace!("ff failed: {}", err); + if let Err(e) = ff_res { + log::trace!("ff failed: {e}"); self.confirm_merge(branch_compare.behind); } } diff --git a/src/popups/rename_branch.rs b/src/popups/rename_branch.rs index bf8e7974f0..05b4ea9371 100644 --- a/src/popups/rename_branch.rs +++ b/src/popups/rename_branch.rs @@ -138,7 +138,7 @@ impl RenameBranchPopup { self.queue.push(InternalEvent::SelectBranch); } Err(e) => { - log::error!("create branch: {}", e,); + log::error!("create branch: {e}"); self.queue.push(InternalEvent::ShowErrorMsg( format!("rename branch error:\n{e}",), )); diff --git a/src/popups/rename_remote.rs b/src/popups/rename_remote.rs index fc88389a84..a5dc914fa2 100644 --- a/src/popups/rename_remote.rs +++ b/src/popups/rename_remote.rs @@ -161,7 +161,7 @@ impl RenameRemotePopup { )); } Err(e) => { - log::error!("rename remote: {}", e,); + log::error!("rename remote: {e}"); self.queue.push(InternalEvent::ShowErrorMsg( format!("rename remote error:\n{e}",), )); diff --git a/src/popups/tag_commit.rs b/src/popups/tag_commit.rs index 696aba171c..b7343d9248 100644 --- a/src/popups/tag_commit.rs +++ b/src/popups/tag_commit.rs @@ -194,7 +194,7 @@ impl TagCommitPopup { self.input.set_text(tag_name); self.hide(); - log::error!("e: {}", e,); + log::error!("e: {e}"); self.queue.push(InternalEvent::ShowErrorMsg( format!("tag error:\n{e}",), )); diff --git a/src/popups/update_remote_url.rs b/src/popups/update_remote_url.rs index 7a6956bb3e..5a7f2aa869 100644 --- a/src/popups/update_remote_url.rs +++ b/src/popups/update_remote_url.rs @@ -138,7 +138,7 @@ impl UpdateRemoteUrlPopup { )); } Err(e) => { - log::error!("update remote url: {}", e,); + log::error!("update remote url: {e}"); self.queue.push(InternalEvent::ShowErrorMsg( format!("update remote url error:\n{e}",), )); diff --git a/src/tabs/revlog.rs b/src/tabs/revlog.rs index 74f7d1b0cc..9200c93f00 100644 --- a/src/tabs/revlog.rs +++ b/src/tabs/revlog.rs @@ -250,7 +250,7 @@ impl Revlog { self.search, LogSearch::Off | LogSearch::Results(_) ) { - log::info!("start search: {:?}", options); + log::info!("start search: {options:?}"); let filter = filter_commit_by_search( LogFilterSearch::new(options.clone()), diff --git a/src/ui/style.rs b/src/ui/style.rs index a4599ff7d9..be21f76b9f 100644 --- a/src/ui/style.rs +++ b/src/ui/style.rs @@ -308,7 +308,7 @@ impl Theme { let mut theme = Self::default(); if let Ok(patch) = Self::load_patch(theme_path).map_err(|e| { - log::error!("theme error [{:?}]: {e}", theme_path); + log::error!("theme error [{theme_path:?}]: {e}"); e }) { theme.apply(patch); @@ -317,15 +317,9 @@ impl Theme { theme = old_theme; if theme.save_patch(theme_path).is_ok() { - log::info!( - "Converted old theme to new format. ({:?})", - theme_path - ); + log::info!("Converted old theme to new format. ({theme_path:?})"); } else { - log::warn!( - "Failed to save theme in new format. ({:?})", - theme_path - ); + log::warn!("Failed to save theme in new format. ({theme_path:?})"); } } diff --git a/src/ui/syntax_text.rs b/src/ui/syntax_text.rs index 3985baa502..5be2192ea8 100644 --- a/src/ui/syntax_text.rs +++ b/src/ui/syntax_text.rs @@ -129,7 +129,7 @@ impl SyntaxText { let ops = state .parse_line(line, &SYNTAX_SET) .map_err(|e| { - log::error!("syntax error: {:?}", e); + log::error!("syntax error: {e:?}"); asyncgit::Error::Generic( "syntax error".to_string(), ) diff --git a/src/watcher.rs b/src/watcher.rs index 9c557b92bb..ea30c7f135 100644 --- a/src/watcher.rs +++ b/src/watcher.rs @@ -30,7 +30,7 @@ impl RepoWatcher { thread::spawn(move || { if let Err(e) = Self::forwarder(&rx, &out_tx) { //maybe we need to restart the forwarder now? - log::error!("notify receive error: {}", e); + log::error!("notify receive error: {e}"); } }); @@ -53,7 +53,7 @@ impl RepoWatcher { log::debug!("notify events: {}", ev.len()); for (idx, ev) in ev.iter().enumerate() { - log::debug!("notify [{}]: {:?}", idx, ev); + log::debug!("notify [{idx}]: {ev:?}"); } if !ev.is_empty() {