Reduce allocations (#30693)

Removes a unnecessary string conversion and some clones

Release Notes:

- N/A
This commit is contained in:
tidely 2025-05-14 19:29:28 +03:00 committed by GitHub
parent fcfe4e2c14
commit bc99a86bb7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
17 changed files with 48 additions and 57 deletions

View file

@ -2583,19 +2583,18 @@ impl GitPanel {
} else {
workspace.update(cx, |workspace, cx| {
let workspace_weak = cx.weak_entity();
let toast =
StatusToast::new(format!("git {} failed", action.clone()), cx, |this, _cx| {
this.icon(ToastIcon::new(IconName::XCircle).color(Color::Error))
.action("View Log", move |window, cx| {
let message = message.clone();
let action = action.clone();
workspace_weak
.update(cx, move |workspace, cx| {
Self::open_output(action, workspace, &message, window, cx)
})
.ok();
})
});
let toast = StatusToast::new(format!("git {} failed", action), cx, |this, _cx| {
this.icon(ToastIcon::new(IconName::XCircle).color(Color::Error))
.action("View Log", move |window, cx| {
let message = message.clone();
let action = action.clone();
workspace_weak
.update(cx, move |workspace, cx| {
Self::open_output(action, workspace, &message, window, cx)
})
.ok();
})
});
workspace.toggle_status_toast(toast, cx)
});
}