gpui: Implement From<String> for ElementId (#44447)

Release Notes:

- N/A

## Before

```rs
div()
    .id(SharedString::from(format!("process-entry-{ix}-command")))
```

## After

```rs
div()
    .id(format!("process-entry-{ix}-command"))
```
This commit is contained in:
Jason Lee
2025-12-09 09:08:59 +01:00
committed by GitHub
parent 0b4f72e549
commit 4e75f0f3ab
18 changed files with 42 additions and 33 deletions
+2 -2
View File
@@ -317,7 +317,7 @@ impl PickerDelegate for AttachModalDelegate {
let candidate = self.candidates.get(hit.candidate_id)?;
Some(
ListItem::new(SharedString::from(format!("process-entry-{ix}")))
ListItem::new(format!("process-entry-{ix}"))
.inset(true)
.spacing(ListItemSpacing::Sparse)
.toggle_state(selected)
@@ -327,7 +327,7 @@ impl PickerDelegate for AttachModalDelegate {
.child(Label::new(format!("{} {}", candidate.name, candidate.pid)))
.child(
div()
.id(SharedString::from(format!("process-entry-{ix}-command")))
.id(format!("process-entry-{ix}-command"))
.tooltip(Tooltip::text(
candidate
.command
+1 -1
View File
@@ -1519,7 +1519,7 @@ impl PickerDelegate for DebugDelegate {
});
Some(
ListItem::new(SharedString::from(format!("debug-scenario-selection-{ix}")))
ListItem::new(format!("debug-scenario-selection-{ix}"))
.inset(true)
.start_slot::<IconWithIndicator>(icon)
.spacing(ListItemSpacing::Sparse)
+3 -6
View File
@@ -286,10 +286,10 @@ impl Item for SubView {
impl Render for SubView {
fn render(&mut self, window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
v_flex()
.id(SharedString::from(format!(
.id(format!(
"subview-container-{}",
self.kind.to_shared_string()
)))
))
.on_hover(cx.listener(|this, hovered, _, cx| {
this.hovered = *hovered;
cx.notify();
@@ -484,10 +484,7 @@ pub(crate) fn new_debugger_pane(
let deemphasized = !pane.has_focus(window, cx);
let item_ = item.boxed_clone();
div()
.id(SharedString::from(format!(
"debugger_tab_{}",
item.item_id().as_u64()
)))
.id(format!("debugger_tab_{}", item.item_id().as_u64()))
.p_1()
.rounded_md()
.cursor_pointer()