code: Use chained if-let's

This commit is contained in:
Sophie Herold 2026-01-29 19:04:26 +01:00
parent f806bbd484
commit 8972c5efb9
12 changed files with 219 additions and 235 deletions

View file

@ -575,10 +575,10 @@ impl LpImageWindow {
if let Some(ref file) = imp.image_view.current_file() {
let launcher = gtk::FileLauncher::new(Some(file));
launcher.set_always_ask(true);
if let Err(e) = launcher.launch_future(self.try_window().as_ref()).await {
if !e.matches(gtk::DialogError::Dismissed) {
tracing::error!("Could not open image in external program: {}", e);
}
if let Err(e) = launcher.launch_future(self.try_window().as_ref()).await
&& !e.matches(gtk::DialogError::Dismissed)
{
tracing::error!("Could not open image in external program: {}", e);
}
} else {
tracing::error!("Could not load a path for the current image.")
@ -611,12 +611,11 @@ impl LpImageWindow {
return false;
};
if let Some(focus_widget) = GtkWindowExt::focus(&window) {
if focus_widget.is_ancestor(&*self.imp().properties_view) {
if let Ok(label) = focus_widget.downcast::<gtk::Label>() {
return label.selection_bounds().is_some();
}
}
if let Some(focus_widget) = GtkWindowExt::focus(&window)
&& focus_widget.is_ancestor(&*self.imp().properties_view)
&& let Ok(label) = focus_widget.downcast::<gtk::Label>()
{
return label.selection_bounds().is_some();
}
false