From 7c2e75f48d20387ed27f38b3c9f2d28ae8adf84f Mon Sep 17 00:00:00 2001 From: Tim Blackbird Date: Mon, 7 Oct 2024 18:50:48 +0200 Subject: [PATCH] code quality --- crates/bevy_picking/src/focus.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/bevy_picking/src/focus.rs b/crates/bevy_picking/src/focus.rs index bc8ec42340..d07c0c095f 100644 --- a/crates/bevy_picking/src/focus.rs +++ b/crates/bevy_picking/src/focus.rs @@ -136,7 +136,7 @@ fn build_over_map( .or_insert_with(BTreeMap::new); for (entity, pick_data) in entities_under_pointer.picks.iter() { let layer = entities_under_pointer.order; - let hits = layer_map.entry(FloatOrd(layer)).or_insert_with(Vec::new); + let hits = layer_map.entry(FloatOrd(layer)).or_default(); hits.push((*entity, pick_data.clone())); } } @@ -159,7 +159,7 @@ fn build_hover_map( hover_map: &mut HoverMap, ) { for pointer_id in pointers.iter() { - let pointer_entity_set = hover_map.entry(*pointer_id).or_insert_with(HashMap::new); + let pointer_entity_set = hover_map.entry(*pointer_id).or_default(); if let Some(layer_map) = over_map.get(pointer_id) { // Note we reverse here to start from the highest layer first. for (entity, pick_data) in layer_map.values().rev().flatten() {