refactor: use nodes::eval helper in formatting

this also silences the corresponding dead_code warning with bin builds
This commit is contained in:
electria 2026-09-30 19:51:41 -07:00
commit 3d67c22905
Signed by: electria
SSH key fingerprint: SHA256:8LlB3ucPbBHqozqkhsNbaV5oG3SlzzqUj8FZDL6IPQs

View file

@ -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!(