code: Fix clippy warnings
This commit is contained in:
parent
70e18de073
commit
2adefc5241
5 changed files with 10 additions and 10 deletions
|
|
@ -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())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue