Another batch of fixups

This commit is contained in:
Piotr Osiewicz 2024-01-02 00:24:11 +01:00
parent 2621efebea
commit a3759f9a33
3 changed files with 6 additions and 10 deletions

View File

@ -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() {

View File

@ -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 {

View File

@ -27,7 +27,7 @@ pub struct CascadeSlot(usize);
impl<S: Refineable + Default> Cascade<S> {
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,11 +40,9 @@ impl<S: Refineable + Default> Cascade<S> {
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 {
for refinement in self.0.iter().skip(1).flatten() {
merged.refine(refinement);
}
}
merged
}
}