diff options
author | Lars Wirzenius <liw@liw.fi> | 2021-07-24 13:13:03 +0300 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2021-07-24 13:13:03 +0300 |
commit | 2ebe8a73858537009216f20bde4327b70c5398fa (patch) | |
tree | be4720a3a6a9f18850b016c6cf1fa6dca6d5602f /src | |
parent | 6b49457451b567addf3a5a37c30f1b69f9dfd693 (diff) | |
download | vmadm-2ebe8a73858537009216f20bde4327b70c5398fa.tar.gz |
refactor: use Option::map instead of doing it manually
Sponsored-by: author
Diffstat (limited to 'src')
-rw-r--r-- | src/spec.rs | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/spec.rs b/src/spec.rs index 85a3ae9..bf622c0 100644 --- a/src/spec.rs +++ b/src/spec.rs @@ -60,11 +60,10 @@ impl OneVmInputSpecification { } fn image(&self, config: &Configuration, name: &str) -> Result<PathBuf, SpecificationError> { - let default_image = if let Some(dirname) = &config.image_directory { - Some(dirname.join(format!("{}.qcow2", name))) - } else { - None - }; + let default_image = &config + .image_directory + .as_ref() + .map(|dirname| dirname.join(format!("{}.qcow2", name))); get( &self.image, |