From a3759f9a33361ca2c732fbb7a7226b22eee0f0cf Mon Sep 17 00:00:00 2001 From: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com> Date: Tue, 2 Jan 2024 00:24:11 +0100 Subject: [PATCH] Another batch of fixups --- crates/gpui2/src/window.rs | 4 ++-- .../refineable/derive_refineable/src/derive_refineable.rs | 4 +--- crates/refineable/src/refineable.rs | 8 +++----- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/crates/gpui2/src/window.rs b/crates/gpui2/src/window.rs index 76e5e9f64e..bb81a85821 100644 --- a/crates/gpui2/src/window.rs +++ b/crates/gpui2/src/window.rs @@ -637,7 +637,7 @@ impl<'a> WindowContext<'a> { let handle = self.window.handle; let display_id = self.window.display_id; - if let std::collections::hash_map::Entry::Vacant(e) = self.frame_consumers.entry(display_id) { + if !self.frame_consumers.contains_key(&display_id) { let (tx, mut rx) = mpsc::unbounded::<()>(); self.platform.set_display_link_output_callback( display_id, @@ -669,7 +669,7 @@ impl<'a> WindowContext<'a> { .ok(); } }); - e.insert(consumer_task); + self.frame_consumers.insert(display_id, consumer_task); } if self.next_frame_callbacks.is_empty() { diff --git a/crates/refineable/derive_refineable/src/derive_refineable.rs b/crates/refineable/derive_refineable/src/derive_refineable.rs index 15293d866a..ad7678b58f 100644 --- a/crates/refineable/derive_refineable/src/derive_refineable.rs +++ b/crates/refineable/derive_refineable/src/derive_refineable.rs @@ -85,9 +85,7 @@ pub fn derive_refineable(input: TokenStream) -> TokenStream { // Append to where_clause or create a new one if it doesn't exist let where_clause = match where_clause.cloned() { Some(mut where_clause) => { - where_clause - .predicates - .extend(type_param_bounds.into_iter()); + where_clause.predicates.extend(type_param_bounds); where_clause.clone() } None => WhereClause { diff --git a/crates/refineable/src/refineable.rs b/crates/refineable/src/refineable.rs index b588b5b9d8..93e2e40ac6 100644 --- a/crates/refineable/src/refineable.rs +++ b/crates/refineable/src/refineable.rs @@ -27,7 +27,7 @@ pub struct CascadeSlot(usize); impl Cascade { pub fn reserve(&mut self) -> CascadeSlot { self.0.push(None); - return CascadeSlot(self.0.len() - 1); + CascadeSlot(self.0.len() - 1) } pub fn base(&mut self) -> &mut S::Refinement { @@ -40,10 +40,8 @@ impl Cascade { pub fn merged(&self) -> S::Refinement { let mut merged = self.0[0].clone().unwrap(); - for refinement in self.0.iter().skip(1) { - if let Some(refinement) = refinement { - merged.refine(refinement); - } + for refinement in self.0.iter().skip(1).flatten() { + merged.refine(refinement); } merged }