diff --git a/src/decoder/tiling.rs b/src/decoder/tiling.rs index 650f962..56026c7 100644 --- a/src/decoder/tiling.rs +++ b/src/decoder/tiling.rs @@ -117,7 +117,7 @@ impl Tile { snapshot.append_scaled_texture(&self.texture, options.scaling_filter, &area_with_bleed); snapshot.pop(); - if std::env::var_os("LOUPE_TILING_DEBUG").map_or(false, |x| x.len() > 0) { + if std::env::var_os("LOUPE_TILING_DEBUG").is_some_and(|x| x.len() > 0) { snapshot.append_inset_shadow( &gsk::RoundedRect::from_rect(area, 0.), &gdk::RGBA::new(1., 0., 0., 0.7), @@ -180,14 +180,14 @@ impl FrameBuffer { pub fn contains(&self, zoom: f64, coordinates: Coordinates) -> bool { self.images .front() - .map_or(false, |x| x.contains(zoom, coordinates)) + .is_some_and(|x| x.contains(zoom, coordinates)) } /// Returns true if there are no textures pub fn is_empty(&self) -> bool { self.images .front() - .map_or(false, |x| x.tile_layers.is_empty()) + .is_some_and(|x| x.tile_layers.is_empty()) } } diff --git a/src/widgets/edit/crop_selection.rs b/src/widgets/edit/crop_selection.rs index d432d25..09607af 100644 --- a/src/widgets/edit/crop_selection.rs +++ b/src/widgets/edit/crop_selection.rs @@ -257,7 +257,7 @@ mod imp { corner, initial_selection: crop_area, })); - } else if hovered_widget.map_or(false, |x| x == *imp.selection) { + } else if hovered_widget.is_some_and(|x| x == *imp.selection) { gesture.set_state(gtk::EventSequenceState::Claimed); let crop_area = imp.crop_area(); diff --git a/src/widgets/image/loading.rs b/src/widgets/image/loading.rs index 6c666e7..af520aa 100644 --- a/src/widgets/image/loading.rs +++ b/src/widgets/image/loading.rs @@ -210,7 +210,7 @@ impl imp::LpImage { let obj = self.obj().to_owned(); // current file got replaced with a new one - let file_replace = obj.file().map_or(false, |x| x.equal(&file)); + let file_replace = obj.file().is_some_and(|x| x.equal(&file)); if file_replace { log::debug!("Image got replaced {}", file.uri()); // TODO: error handling is missing diff --git a/src/widgets/image_window.rs b/src/widgets/image_window.rs index 3870667..64486e2 100644 --- a/src/widgets/image_window.rs +++ b/src/widgets/image_window.rs @@ -438,10 +438,10 @@ mod imp { impl LpImageWindow { fn is_showing_image(&self) -> bool { - self.image_view.try_get().map_or(false, |image_view| { + self.image_view.try_get().is_some_and(|image_view| { image_view .current_page() - .map_or(false, |page| page.image().error().is_none()) + .is_some_and(|page| page.image().error().is_none()) }) } } @@ -778,7 +778,7 @@ impl LpImageWindow { .imp() .image_view .current_image() - .map_or(false, |x| x.editable()); + .is_some_and(|x| x.editable()); self.action_set_enabled(&Action::Edit, enable_editing); } diff --git a/src/widgets/sliding_view.rs b/src/widgets/sliding_view.rs index d7c301c..5eb6b2c 100644 --- a/src/widgets/sliding_view.rs +++ b/src/widgets/sliding_view.rs @@ -509,7 +509,7 @@ impl LpSlidingView { if let Some(index) = self.index_of(page) { // Only unparent if far enough away to not be involved in delete animation - if current_index.map_or(false, |x| x.abs_diff(index) as isize > 1) { + if current_index.is_some_and(|x| x.abs_diff(index) as isize > 1) { page.unparent(); } @@ -598,7 +598,7 @@ impl LpSlidingView { if let Some(index) = self.index_of(page) { if self .current_index() - .map_or(false, |x| (x as i64 - index as i64).abs() == 1) + .is_some_and(|x| (x as i64 - index as i64).abs() == 1) { self.step_to(page); } else {