cleanup format strings (#2765)

This commit is contained in:
extrawurst 2025-10-29 13:58:27 +01:00 committed by GitHub
parent 35fa0ce8d2
commit 1032cccd55
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
31 changed files with 51 additions and 68 deletions

View file

@ -130,7 +130,7 @@ impl<J: 'static + AsyncJob> AsyncSingleJob<J> {
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}");
}
});

View file

@ -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,

View file

@ -89,7 +89,7 @@ impl AsyncCommitFiles {
return Ok(());
}
log::trace!("request: {:?}", params);
log::trace!("request: {params:?}");
{
let current = self.current.lock()?;

View file

@ -98,7 +98,7 @@ impl AsyncDiff {
&self,
params: DiffParams,
) -> Result<Option<FileDiff>> {
log::trace!("request {:?}", params);
log::trace!("request {params:?}");
let hash = hash(&params);
@ -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,

View file

@ -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()))
}
};

View file

@ -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())
}
};

View file

@ -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())
}
};

View file

@ -96,8 +96,7 @@ impl RemoteProgress {
}
Err(e) => {
log::error!(
"remote progress receiver error: {}",
e
"remote progress receiver error: {e}",
);
break;
}

View file

@ -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:?})",
);
{

View file

@ -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<Cred, GitError> {
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.

View file

@ -26,7 +26,7 @@ impl From<RepositoryState> 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
}
}

View file

@ -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}",),
));

View file

@ -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(())

View file

@ -471,7 +471,6 @@ impl Component for StatusTreeComponent {
CommandBlocking::PassingOn
}
#[expect(clippy::cognitive_complexity)]
fn event(&mut self, ev: &Event) -> Result<EventState> {
if self.focused {
if let Event::Key(e) = ev {

View file

@ -76,7 +76,7 @@ impl FileTreeItem {
),
kind: FileTreeItemKind::File(item.clone()),
}),
None => bail!("invalid file name {:?}", item),
None => bail!("invalid file name {item:?}"),
}
}

View file

@ -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);
}
});

View file

@ -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:?}");
}
})?;

View file

@ -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}");
}
}

View file

@ -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()

View file

@ -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}",),
));

View file

@ -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}",),
));

View file

@ -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(())
}

View file

@ -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);
}
}

View file

@ -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}",),
));

View file

@ -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}",),
));

View file

@ -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}",),
));

View file

@ -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}",),
));

View file

@ -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()),

View file

@ -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:?})");
}
}

View file

@ -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(),
)

View file

@ -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() {