From 45fe7a254f2b6815f4111670f23beb436d162312 Mon Sep 17 00:00:00 2001 From: LinlyBoi Date: Thu, 18 May 2023 07:56:13 +0300 Subject: [PATCH] replaced defaults with new --- src/calc.rs | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/src/calc.rs b/src/calc.rs index 26592d7..d2735bc 100644 --- a/src/calc.rs +++ b/src/calc.rs @@ -3,15 +3,6 @@ struct calcNode { left: Option>, right: Option>, } -impl Default for calcNode { - fn default() -> Self { - Self { - item: Item::Num(1), - left: None, - right: None, - } - } -} impl calcNode { pub fn new(item: Item, left: Option>, right: Option>) -> Self { @@ -28,9 +19,13 @@ pub enum Operation { Div, Mult, } -#[derive(Default)] pub struct calcTree { root: calcNode, } -impl calcTree {} +impl calcTree { + pub fn new(item: Item) -> Self { + let root = calcNode::new(item, None, None); + Self { root } + } +}