mirror of https://github.com/rm-dr/daisy
Minor cleanup
parent
682205f5e1
commit
8497c125ef
|
@ -61,7 +61,7 @@ impl Config {
|
||||||
|
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
#[derive(Clone)]
|
//#[derive(Clone)]
|
||||||
pub struct Context {
|
pub struct Context {
|
||||||
pub config: Config,
|
pub config: Config,
|
||||||
|
|
||||||
|
@ -76,12 +76,12 @@ pub struct Context {
|
||||||
// General functions
|
// General functions
|
||||||
impl Context {
|
impl Context {
|
||||||
pub fn new() -> Context {
|
pub fn new() -> Context {
|
||||||
Context{
|
Context {
|
||||||
config: Config::new(),
|
config: Config::new(),
|
||||||
history: Vec::new(),
|
history: Vec::new(),
|
||||||
variables: HashMap::new(),
|
variables: HashMap::new(),
|
||||||
functions: HashMap::new(),
|
functions: HashMap::new(),
|
||||||
shadow: HashMap::new(),
|
shadow: HashMap::new()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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(la, a) = a {
|
||||||
if let Expression::Quantity(lb, b) = b {
|
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)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -275,7 +275,6 @@ impl Unit {
|
||||||
let mut q = Quantity::new_rational(1f64).unwrap();
|
let mut q = Quantity::new_rational(1f64).unwrap();
|
||||||
q.set_unit(b);
|
q.set_unit(b);
|
||||||
return Some(q);
|
return Some(q);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue