diff --git a/src/decoder/tiling.rs b/src/decoder/tiling.rs index 9b8c883..330888c 100644 --- a/src/decoder/tiling.rs +++ b/src/decoder/tiling.rs @@ -304,7 +304,9 @@ impl TiledImage { } pub fn contains(&self, zoom: f64, coordinates: Coordinates) -> bool { - let Some(tile_layer) = self.tile_layers.get(&zoom_to_level(zoom)) else { return false }; + let Some(tile_layer) = self.tile_layers.get(&zoom_to_level(zoom)) else { + return false; + }; tile_layer.tiles.contains_key(&coordinates) } @@ -483,7 +485,9 @@ impl Tiling { for x in (x0 as i32..=x1 as i32).step_by(self.tile_width.into()) { for y in (y0 as i32..=y1 as i32).step_by(self.tile_height.into()) { let area = graphene::Rect::new(x as f32, y as f32, tile_width, tile_height); - let Some(restricted_area) = area.restrict(original_width, original_height) else { continue; }; + let Some(restricted_area) = area.restrict(original_width, original_height) else { + continue; + }; let tile = TileInstructions { tiling: *self, diff --git a/src/file_model.rs b/src/file_model.rs index 0f6a1fe..ab444c8 100644 --- a/src/file_model.rs +++ b/src/file_model.rs @@ -242,7 +242,9 @@ impl LpFileModel { } fn is_image_file(file: &gio::File) -> bool { - let Ok(info) = util::query_attributes(file, vec![gio::FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE]) else { + let Ok(info) = + util::query_attributes(file, vec![gio::FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE]) + else { log::warn!("Could not query file info: {}", file.uri()); return false; }; diff --git a/src/util/mod.rs b/src/util/mod.rs index 2e916ec..14fea71 100644 --- a/src/util/mod.rs +++ b/src/util/mod.rs @@ -125,11 +125,17 @@ pub async fn untrash(path: &Path) -> anyhow::Result<()> { .next_files_future(1, glib::Priority::default()) .await { - let Some(file_info) = info.first() - else { break; }; + let Some(file_info) = info.first() else { + break; + }; - let Some(original_path) = file_info.attribute_byte_string(gio::FILE_ATTRIBUTE_TRASH_ORIG_PATH).as_ref().map(PathBuf::from) - else { break; }; + let Some(original_path) = file_info + .attribute_byte_string(gio::FILE_ATTRIBUTE_TRASH_ORIG_PATH) + .as_ref() + .map(PathBuf::from) + else { + break; + }; if original_path == path { let trash_file = trash.child(file_info.name()); @@ -143,7 +149,9 @@ pub async fn untrash(path: &Path) -> anyhow::Result<()> { } // Construct new name of the form " (i)." - let Some(path) = original_file.path() else { bail!("File without path") }; + let Some(path) = original_file.path() else { + bail!("File without path") + }; let mut name = path .file_stem() .map(|x| x.to_os_string()) diff --git a/src/widgets/image.rs b/src/widgets/image.rs index 58c4328..29f3e12 100644 --- a/src/widgets/image.rs +++ b/src/widgets/image.rs @@ -1805,10 +1805,18 @@ impl LpImage { let mut bad_contrast = 0; 'img: loop { for _ in 0..texture.width() { - let Some(r) = bytes_iter.next() else { break 'img; }; - let Some(g) = bytes_iter.next() else { break 'img; }; - let Some(b) = bytes_iter.next() else { break 'img; }; - let Some(a) = bytes_iter.next() else { break 'img; }; + let Some(r) = bytes_iter.next() else { + break 'img; + }; + let Some(g) = bytes_iter.next() else { + break 'img; + }; + let Some(b) = bytes_iter.next() else { + break 'img; + }; + let Some(a) = bytes_iter.next() else { + break 'img; + }; if *a < 255 { has_transparency = true; diff --git a/src/widgets/image_view.rs b/src/widgets/image_view.rs index a060df0..c96b87b 100644 --- a/src/widgets/image_view.rs +++ b/src/widgets/image_view.rs @@ -416,7 +416,10 @@ impl LpImageView { fn scroll_sliding_view(&self, file: &gio::File) { let Some(current_page) = self.sliding_view().pages().remove(&file.uri()) else { - log::error!("Current path not available in sliding_view for scrolling: {}", file.uri()); + log::error!( + "Current path not available in sliding_view for scrolling: {}", + file.uri() + ); return; }; @@ -482,7 +485,9 @@ impl LpImageView { /// Handle files are added or removed from directory fn model_content_changed_cb(&self) { - let Some(current_file) = self.current_file() else { return; }; + let Some(current_file) = self.current_file() else { + return; + }; // LpImage did not get the update yet // Update will be handled by current_image_path_changed diff --git a/src/window.rs b/src/window.rs index b8ea6ed..2952b3a 100644 --- a/src/window.rs +++ b/src/window.rs @@ -550,8 +550,13 @@ impl LpWindow { async fn trash(&self) { let image_view = self.image_view(); - let (Some(file), Some(path)) = (image_view.current_file(), image_view.current_file().and_then(|x| x.path())) - else { log::error!("No file to trash"); return; }; + let (Some(file), Some(path)) = ( + image_view.current_file(), + image_view.current_file().and_then(|x| x.path()), + ) else { + log::error!("No file to trash"); + return; + }; let result = file.trash_future(glib::Priority::default()).await;