From 1688000fbc4669b30b986370d2773e0a9c55a918 Mon Sep 17 00:00:00 2001 From: Yigit Sever Date: Mon, 19 Apr 2021 03:57:46 +0300 Subject: Add default for Db --- src/schema.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/schema.rs b/src/schema.rs index eae60af..81bfc1b 100644 --- a/src/schema.rs +++ b/src/schema.rs @@ -34,7 +34,7 @@ fn block_parser(path: String) -> u64 { fn last_block_content() -> Option { let blocks = read_block_name().unwrap(); - if blocks.len() == 0 { + if blocks.is_empty() { return None; } @@ -173,6 +173,12 @@ impl Db { } } +impl Default for Db { + fn default() -> Self { + Self::new() + } +} + /// A transaction between `source` and `target` that moves `amount` #[derive(Serialize, Deserialize, Debug, Clone, PartialEq)] pub struct Transaction { -- cgit v1.2.3-70-g09d2