Skip to content

Commit

Permalink
refactor: use anyhow Context where more applicable
Browse files Browse the repository at this point in the history
  • Loading branch information
SeaDve committed Oct 1, 2023
1 parent ac35bf1 commit 7de8427
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/settings.rs
Original file line number Diff line number Diff line change
@@ -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};
Expand Down Expand Up @@ -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) => {
Expand Down

0 comments on commit 7de8427

Please sign in to comment.