From bc3e6649f87ab468e0a564857dbeb23915cf0ef4 Mon Sep 17 00:00:00 2001 From: Marshall Bowers Date: Thu, 14 Dec 2023 18:52:14 -0500 Subject: [PATCH] Fix warning in release mode (#3662) This PR fixes a warning that was present in release mode, which was preventing the nightly builds from running: ``` error: variable does not need to be mutable --> crates/gpui2/src/elements/div.rs:547:9 | 547 | let mut div = Div { | ----^^^ | | | help: remove this `mut` | = note: `-D unused-mut` implied by `-D warnings` ``` Release Notes: - N/A --- crates/gpui2/src/elements/div.rs | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/crates/gpui2/src/elements/div.rs b/crates/gpui2/src/elements/div.rs index 395afdcc88..257ba64b8c 100644 --- a/crates/gpui2/src/elements/div.rs +++ b/crates/gpui2/src/elements/div.rs @@ -544,17 +544,20 @@ pub type ActionListener = Box 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 {