refactor: use nodes::eval helper in formatting
this also silences the corresponding dead_code warning with bin builds
This commit is contained in:
parent
2deabb148e
commit
3d67c22905
1 changed files with 2 additions and 4 deletions
|
|
@ -1,8 +1,6 @@
|
||||||
use std::str::FromStr;
|
|
||||||
|
|
||||||
use rug::Float;
|
use rug::Float;
|
||||||
|
|
||||||
use crate::nodes::{Error, Nodes};
|
use crate::nodes::{self, Error};
|
||||||
|
|
||||||
pub fn pretty_eval(mut input: String) -> Result<String, Error> {
|
pub fn pretty_eval(mut input: String) -> Result<String, Error> {
|
||||||
// no need to remove the characters here,
|
// no need to remove the characters here,
|
||||||
|
|
@ -18,7 +16,7 @@ pub fn pretty_eval(mut input: String) -> Result<String, Error> {
|
||||||
})
|
})
|
||||||
.is_some();
|
.is_some();
|
||||||
|
|
||||||
let result = Nodes::from_str(&input)?.evaluate()?;
|
let result = nodes::eval(&input)?;
|
||||||
let significant_digits = get_significant_digits(&result);
|
let significant_digits = get_significant_digits(&result);
|
||||||
|
|
||||||
Ok(format!(
|
Ok(format!(
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue