From ea964fd73314668f605a8fd7216b650e08241daf Mon Sep 17 00:00:00 2001 From: Dmitry Bogatov Date: Tue, 27 Aug 2019 23:49:18 +0000 Subject: [PATCH] Fix one clippy::unneeded_unwrap warning --- src/context.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/context.rs b/src/context.rs index 45f3c5de4..e1a0725e8 100644 --- a/src/context.rs +++ b/src/context.rs @@ -300,9 +300,11 @@ pub unsafe fn dc_open(context: &Context, dbfile: &str, blobdir: Option<&str>) -> if 0 != dc_is_open(context) { return false; } + *context.dbfile.write().unwrap() = Some(PathBuf::from(dbfile)); - if blobdir.is_some() && !blobdir.unwrap().is_empty() { - let dir = dc_ensure_no_slash_safe(blobdir.unwrap()).strdup(); + let blobdir = blobdir.unwrap_or_default(); + if !blobdir.is_empty() { + let dir = dc_ensure_no_slash_safe(blobdir).strdup(); *context.blobdir.write().unwrap() = dir; } else { let dir = dbfile.to_string() + "-blobs";