From 2949b07d7c163697c7af7c4ee257049594727e56 Mon Sep 17 00:00:00 2001 From: Mark Date: Tue, 1 Aug 2023 09:07:33 -0700 Subject: [PATCH] Minor cleanup --- TODO.md | 1 - src/entry/unix/promptbuffer.rs | 2 +- src/evaluate/operator.rs | 4 ++-- src/parser/expression/expression.rs | 2 +- src/parser/stage/find_subs.rs | 2 +- src/parser/stage/groupify.rs | 2 +- 6 files changed, 6 insertions(+), 7 deletions(-) diff --git a/TODO.md b/TODO.md index 27d6c76..402afc7 100644 --- a/TODO.md +++ b/TODO.md @@ -40,7 +40,6 @@ ## Internals - Non-recursive treeify - Faster factorial function. Maybe use gamma instead? - - Remove extra calls to `.clone()` in quantity module - Arbitrary precision float (rug doesn't offer arbitrary exponents) - Backend-independent colorful printing diff --git a/src/entry/unix/promptbuffer.rs b/src/entry/unix/promptbuffer.rs index 511e000..dbc426a 100644 --- a/src/entry/unix/promptbuffer.rs +++ b/src/entry/unix/promptbuffer.rs @@ -82,7 +82,7 @@ impl PromptBuffer { // Prompt methods 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()); self.buffer.clear(); self.hist_cursor = 0; diff --git a/src/evaluate/operator.rs b/src/evaluate/operator.rs index fff2404..2b0798c 100644 --- a/src/evaluate/operator.rs +++ b/src/evaluate/operator.rs @@ -38,7 +38,7 @@ pub fn eval_operator(g: &Expression, context: &mut Context) -> Result Result { l.clone() } + => { *l } } } diff --git a/src/parser/stage/find_subs.rs b/src/parser/stage/find_subs.rs index 841ad43..086fceb 100644 --- a/src/parser/stage/find_subs.rs +++ b/src/parser/stage/find_subs.rs @@ -84,7 +84,7 @@ pub fn find_subs( } else { let target = target.unwrap(); 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 new_len = target.chars().count(); diff --git a/src/parser/stage/groupify.rs b/src/parser/stage/groupify.rs index 99ea6ee..317dd36 100644 --- a/src/parser/stage/groupify.rs +++ b/src/parser/stage/groupify.rs @@ -195,7 +195,7 @@ pub fn groupify( (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 let mut levels: Vec<(LineLocation, VecDeque)> = Vec::with_capacity(8);