mirror of https://github.com/rm-dr/daisy
Minor cleanup
parent
8059714319
commit
2949b07d7c
1
TODO.md
1
TODO.md
|
@ -40,7 +40,6 @@
|
||||||
## Internals
|
## Internals
|
||||||
- Non-recursive treeify
|
- Non-recursive treeify
|
||||||
- Faster factorial function. Maybe use gamma instead?
|
- Faster factorial function. Maybe use gamma instead?
|
||||||
- Remove extra calls to `.clone()` in quantity module
|
|
||||||
- Arbitrary precision float (rug doesn't offer arbitrary exponents)
|
- Arbitrary precision float (rug doesn't offer arbitrary exponents)
|
||||||
- Backend-independent colorful printing
|
- Backend-independent colorful printing
|
||||||
|
|
||||||
|
|
|
@ -82,7 +82,7 @@ impl PromptBuffer {
|
||||||
// Prompt methods
|
// Prompt methods
|
||||||
pub fn get_contents(&self) -> &String {&self.buffer}
|
pub fn get_contents(&self) -> &String {&self.buffer}
|
||||||
|
|
||||||
pub fn enter(&mut self) -> String{
|
pub fn enter(&mut self) -> String {
|
||||||
let s = String::from(self.buffer.trim());
|
let s = String::from(self.buffer.trim());
|
||||||
self.buffer.clear();
|
self.buffer.clear();
|
||||||
self.hist_cursor = 0;
|
self.hist_cursor = 0;
|
||||||
|
|
|
@ -38,7 +38,7 @@ pub fn eval_operator(g: &Expression, context: &mut Context) -> Result<Option<Exp
|
||||||
let mut loc: LineLocation;
|
let mut loc: LineLocation;
|
||||||
if let Expression::Quantity(l, s) = &args[0] {
|
if let Expression::Quantity(l, s) = &args[0] {
|
||||||
sum = s.clone();
|
sum = s.clone();
|
||||||
loc = l.clone();
|
loc = *l;
|
||||||
} else { return Ok(None); };
|
} else { return Ok(None); };
|
||||||
|
|
||||||
|
|
||||||
|
@ -111,7 +111,7 @@ pub fn eval_operator(g: &Expression, context: &mut Context) -> Result<Option<Exp
|
||||||
let mut loc: LineLocation;
|
let mut loc: LineLocation;
|
||||||
if let Expression::Quantity(l, s) = &args[0] {
|
if let Expression::Quantity(l, s) = &args[0] {
|
||||||
prod = s.clone();
|
prod = s.clone();
|
||||||
loc = l.clone();
|
loc = *l;
|
||||||
} else { return Ok(None); };
|
} else { return Ok(None); };
|
||||||
|
|
||||||
let mut i: usize = 1;
|
let mut i: usize = 1;
|
||||||
|
|
|
@ -127,7 +127,7 @@ impl Expression {
|
||||||
| Expression::Constant(l, _)
|
| Expression::Constant(l, _)
|
||||||
| Expression::Variable(l, _)
|
| Expression::Variable(l, _)
|
||||||
| Expression::Operator(l, _,_)
|
| Expression::Operator(l, _,_)
|
||||||
=> { l.clone() }
|
=> { *l }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -84,7 +84,7 @@ pub fn find_subs(
|
||||||
} else {
|
} else {
|
||||||
let target = target.unwrap();
|
let target = target.unwrap();
|
||||||
let l = t.get_mut_line_location();
|
let l = t.get_mut_line_location();
|
||||||
r.push_back((l.clone(), String::from(target)));
|
r.push_back((*l, String::from(target)));
|
||||||
|
|
||||||
let old_len = l.len;
|
let old_len = l.len;
|
||||||
let new_len = target.chars().count();
|
let new_len = target.chars().count();
|
||||||
|
|
|
@ -195,7 +195,7 @@ pub fn groupify(
|
||||||
(LineLocation, ParserError)
|
(LineLocation, ParserError)
|
||||||
> {
|
> {
|
||||||
|
|
||||||
let last_linelocation = g.back().unwrap().get_line_location().clone();
|
let last_linelocation: LineLocation = *g.back().unwrap().get_line_location();
|
||||||
|
|
||||||
// Vector of grouping levels
|
// Vector of grouping levels
|
||||||
let mut levels: Vec<(LineLocation, VecDeque<Token>)> = Vec::with_capacity(8);
|
let mut levels: Vec<(LineLocation, VecDeque<Token>)> = Vec::with_capacity(8);
|
||||||
|
|
Loading…
Reference in New Issue