Merge remote-tracking branch 'origin/main' into perf-2

Nathan Sobo created

Change summary

crates/gpui2/src/elements/div.rs | 20 +++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)

Detailed changes

crates/gpui2/src/elements/div.rs 🔗

@@ -667,18 +667,20 @@ pub type ActionListener = Box<dyn Fn(&dyn Any, DispatchPhase, &mut WindowContext
 
 #[track_caller]
 pub fn div() -> Div {
-    #[allow(unused_mut)]
-    let mut div = Div {
-        interactivity: Interactivity::default(),
-        children: SmallVec::default(),
+    #[cfg(debug_assertions)]
+    let interactivity = {
+        let mut interactivity = Interactivity::default();
+        interactivity.location = Some(*core::panic::Location::caller());
+        interactivity
     };
 
-    #[cfg(debug_assertions)]
-    {
-        div.interactivity.location = Some(*core::panic::Location::caller());
-    }
+    #[cfg(not(debug_assertions))]
+    let interactivity = Interactivity::default();
 
-    div
+    Div {
+        interactivity,
+        children: SmallVec::default(),
+    }
 }
 
 pub struct Div {