From 236f06736e45c2a70f43589c9d447a0a3ef240b5 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Sun, 12 Apr 2020 00:08:03 -0400 Subject: improve error handling and reporting --- src/config.rs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/config.rs') diff --git a/src/config.rs b/src/config.rs index 0e79893..55f6806 100644 --- a/src/config.rs +++ b/src/config.rs @@ -47,6 +47,8 @@ impl Config { pub fn save(&self) -> Result<()> { let filename = Self::filename(); + // unwrap is safe here because Self::filename is explicitly + // constructed as a filename in a directory std::fs::create_dir_all(filename.parent().unwrap()) .context(crate::error::SaveConfig)?; let mut fh = std::fs::File::create(filename) -- cgit v1.2.3-54-g00ecf