Minor cleanup

newfloat
Mark 2023-09-20 11:06:37 -07:00
parent 682205f5e1
commit 8497c125ef
Signed by: Mark
GPG Key ID: AD62BB059C2AAEE4
3 changed files with 5 additions and 5 deletions

View File

@ -61,7 +61,7 @@ impl Config {
#[derive(Debug)]
#[derive(Clone)]
//#[derive(Clone)]
pub struct Context {
pub config: Config,
@ -76,12 +76,12 @@ pub struct Context {
// General functions
impl Context {
pub fn new() -> Context {
Context{
Context {
config: Config::new(),
history: Vec::new(),
variables: HashMap::new(),
functions: HashMap::new(),
shadow: HashMap::new(),
shadow: HashMap::new()
}
}

View File

@ -164,7 +164,8 @@ pub fn eval_operator(context: &mut Context, g: &Expression) -> Result<Option<Exp
if let Expression::Quantity(la, a) = a {
if let Expression::Quantity(lb, b) = b {
return Ok(Some(Expression::Quantity(*la + *lb + *op_loc, a.clone() * b.clone())));
let o = a.clone() * b.clone();
return Ok(Some(Expression::Quantity(*la + *lb + *op_loc, o)));
}
}

View File

@ -275,7 +275,6 @@ impl Unit {
let mut q = Quantity::new_rational(1f64).unwrap();
q.set_unit(b);
return Some(q);
}
}