Remove some redundant entity clones (#36274)

`cx.entity()` already returns an owned entity, so there is no need for
these clones.

Release Notes:

- N/A
This commit is contained in:
Finn Evers 2025-08-15 22:27:44 +02:00 committed by GitHub
parent 7199c733b2
commit 3e0a755486
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
32 changed files with 106 additions and 123 deletions

View file

@ -74,7 +74,7 @@ fn test_edit_events(cx: &mut TestAppContext) {
let editor1 = cx.add_window({
let events = events.clone();
|window, cx| {
let entity = cx.entity().clone();
let entity = cx.entity();
cx.subscribe_in(
&entity,
window,
@ -95,7 +95,7 @@ fn test_edit_events(cx: &mut TestAppContext) {
let events = events.clone();
|window, cx| {
cx.subscribe_in(
&cx.entity().clone(),
&cx.entity(),
window,
move |_, _, event: &EditorEvent, _, _| match event {
EditorEvent::Edited { .. } => events.borrow_mut().push(("editor2", "edited")),
@ -19634,13 +19634,8 @@ fn test_crease_insertion_and_rendering(cx: &mut TestAppContext) {
editor.insert_creases(Some(crease), cx);
let snapshot = editor.snapshot(window, cx);
let _div = snapshot.render_crease_toggle(
MultiBufferRow(1),
false,
cx.entity().clone(),
window,
cx,
);
let _div =
snapshot.render_crease_toggle(MultiBufferRow(1), false, cx.entity(), window, cx);
snapshot
})
.unwrap();

View file

@ -7815,7 +7815,7 @@ impl Element for EditorElement {
min_lines,
max_lines,
} => {
let editor_handle = cx.entity().clone();
let editor_handle = cx.entity();
let max_line_number_width =
self.max_line_number_width(&editor.snapshot(window, cx), window);
window.request_measured_layout(