code: Fix clippy warnings

This commit is contained in:
Sophie Herold 2025-01-13 15:02:01 +01:00
parent 70e18de073
commit 2adefc5241
5 changed files with 10 additions and 10 deletions

View file

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

View file

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

View file

@ -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);
}

View file

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