Skip to content

Commit 81e68f6

Browse files
committed
Clean up getting entry to window map for winit
1 parent a7e635f commit 81e68f6

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

crates/bevy_winit/src/winit_windows.rs

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -142,15 +142,10 @@ impl WinitWindows {
142142
}
143143
}
144144

145-
// TODO: Might be more elegant ways to get return the reference of the winit-window
146-
let id = winit_window.id();
147-
self.windows.insert(winit_window.id(), winit_window);
148-
let created_window = self
149-
.windows
150-
.get(&id)
151-
.expect("Winit should alway have the window it just created");
152-
153-
created_window
145+
self.windows
146+
.entry(winit_window.id())
147+
.insert(winit_window)
148+
.into_mut()
154149
}
155150

156151
/// Get the winit window that is associated with our entity.

0 commit comments

Comments
 (0)