From 6a34e7a8fdf71a1905ea42398b1ec95f8e0e952c Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Tue, 24 Apr 2018 21:27:59 +0200 Subject: [PATCH] Derive Default for FSFileAbstraction, reduces boilerplate --- lib/core/libimagstore/src/file_abstraction/fs.rs | 11 ++--------- lib/core/libimagstore/src/store.rs | 2 +- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/lib/core/libimagstore/src/file_abstraction/fs.rs b/lib/core/libimagstore/src/file_abstraction/fs.rs index c1d5c4c1..a41a2239 100644 --- a/lib/core/libimagstore/src/file_abstraction/fs.rs +++ b/lib/core/libimagstore/src/file_abstraction/fs.rs @@ -105,15 +105,8 @@ impl FileAbstractionInstance for FSFileAbstractionInstance { /// `FSFileAbstraction` state type /// /// A lazy file is either absent, but a path to it is available, or it is present. -#[derive(Debug)] -pub struct FSFileAbstraction { -} - -impl FSFileAbstraction { - pub fn new() -> FSFileAbstraction { - FSFileAbstraction { } - } -} +#[derive(Debug, Default)] +pub struct FSFileAbstraction {} impl FileAbstraction for FSFileAbstraction { diff --git a/lib/core/libimagstore/src/store.rs b/lib/core/libimagstore/src/store.rs index 57a4a7dd..039b6b3f 100644 --- a/lib/core/libimagstore/src/store.rs +++ b/lib/core/libimagstore/src/store.rs @@ -235,7 +235,7 @@ impl Store { /// - On success: Store object /// pub fn new(location: PathBuf, store_config: &Option) -> Result { - let backend = Box::new(FSFileAbstraction::new()); + let backend = Box::new(FSFileAbstraction::default()); Store::new_with_backend(location, store_config, backend) }