From 7de84274e4a2ed332a822954c40101c15203a33b Mon Sep 17 00:00:00 2001 From: Dave Patrick Caberto Date: Sun, 1 Oct 2023 10:04:30 +0800 Subject: [PATCH] refactor: use anyhow Context where more applicable --- src/settings.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/settings.rs b/src/settings.rs index 4d134e7d..8582a8ab 100644 --- a/src/settings.rs +++ b/src/settings.rs @@ -1,5 +1,5 @@ use adw::prelude::*; -use anyhow::{anyhow, Result}; +use anyhow::{Context, Result}; use gettextrs::gettext; use gsettings_macro::gen_settings; use gtk::{gio, glib}; @@ -40,9 +40,7 @@ impl Settings { match dialog.select_folder_future(Some(transient_for)).await { Ok(folder) => { - let path = folder - .path() - .ok_or_else(|| anyhow!("Folder does not have a path"))?; + let path = folder.path().context("Folder does not have a path")?; self.0.set("saving-location", path).unwrap(); } Err(err) => {