1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-29 04:40:03 -04:00

Use explicit Arc::clone to clarify when clones are cheap (#7784)

This commit is contained in:
Emil Ernerfeldt
2025-12-17 17:19:18 +01:00
committed by GitHub
parent 6157a35985
commit 986c2c0ffb
40 changed files with 80 additions and 71 deletions

View File

@@ -91,7 +91,7 @@ impl ViewportState {
if ui.input(|i| i.viewport().close_requested()) {
vp_state.visible = false;
}
let count = count.clone();
let count = Arc::clone(&count);
show_as_popup(ui, class, move |ui: &mut egui::Ui| {
let current_count = *count.read();
ui.label(format!("Callback has been reused {current_count} times"));
@@ -289,7 +289,7 @@ fn generic_ui(ui: &mut egui::Ui, children: &[Arc<RwLock<ViewportState>>], close_
*visible
};
if visible {
ViewportState::show(child.clone(), &ctx, close_button);
ViewportState::show(Arc::clone(child), &ctx, close_button);
}
}
}