Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Fix warning in release mode (#3662)

Marshall Bowersbc3e6649f87a
diff --git a/crates/gpui2/src/elements/div.rs b/crates/gpui2/src/elements/div.rs
index 395afdcc884..257ba64b8c3 100644
--- a/crates/gpui2/src/elements/div.rs
+++ b/crates/gpui2/src/elements/div.rs
@@ -544,17 +544,20 @@ pub type ActionListener = Box<dyn Fn(&dyn Any, DispatchPhase, &mut WindowContext
#[track_caller]
pub fn div() -> Div {
- 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 {