Skip to content

Commit 3197e52

Browse files
ids1024Drakulix
authored andcommitted
Unwrap user data in cursor_image_status
This is added on creation of the seat, and unwrapped, when setting the status, so the `unwrap_or` case here seems unnecessary.
1 parent fa4bffd commit 3197e52

File tree

1 file changed

+9
-13
lines changed

1 file changed

+9
-13
lines changed

src/shell/seats.rs

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -377,19 +377,15 @@ impl SeatExt for Seat<State> {
377377
}
378378

379379
fn cursor_image_status(&self) -> CursorImageStatus {
380-
self.user_data()
381-
.get::<Mutex<CursorImageStatus>>()
382-
// Reset the cursor if the surface is no longer alive
383-
.map(|lock| {
384-
let mut cursor_status = lock.lock().unwrap();
385-
if let CursorImageStatus::Surface(ref surface) = *cursor_status {
386-
if !surface.alive() {
387-
*cursor_status = CursorImageStatus::default_named();
388-
}
389-
}
390-
cursor_status.clone()
391-
})
392-
.unwrap_or(CursorImageStatus::default_named())
380+
let lock = self.user_data().get::<Mutex<CursorImageStatus>>().unwrap();
381+
// Reset the cursor if the surface is no longer alive
382+
let mut cursor_status = lock.lock().unwrap();
383+
if let CursorImageStatus::Surface(ref surface) = *cursor_status {
384+
if !surface.alive() {
385+
*cursor_status = CursorImageStatus::default_named();
386+
}
387+
}
388+
cursor_status.clone()
393389
}
394390

395391
fn set_cursor_image_status(&self, status: CursorImageStatus) {

0 commit comments

Comments
 (0)