This commit is contained in:
brevalferrari 2025-05-28 13:29:06 +02:00
parent 73fb1d52b5
commit ce5a8760c1

View file

@ -227,7 +227,7 @@ impl Clone for Expression {
fn clone(&self) -> Self { fn clone(&self) -> Self {
self.from self.from
.parse() .parse()
.expect(&format!("expression {self:?} have an invalid from")) .unwrap_or_else(|_| panic!("expression {self:?} have an invalid from"))
} }
} }
@ -316,7 +316,7 @@ impl Context {
.filter_map(|(c, e)| (c == &var).then_some(e)) .filter_map(|(c, e)| (c == &var).then_some(e))
.collect(); .collect();
if result.is_empty() { if result.is_empty() {
return Err(SlopeNotFoundError(var)); Err(SlopeNotFoundError(var))
} else { } else {
Ok(result) Ok(result)
} }
@ -379,7 +379,7 @@ impl Context {
}: &Expression, }: &Expression,
ns: &mut impl EvalNamespace, ns: &mut impl EvalNamespace,
) -> Result<f64, fasteval::Error> { ) -> Result<f64, fasteval::Error> {
instruction.eval(&slab, ns) instruction.eval(slab, ns)
} }
pub fn render(&mut self, n: Option<u8>) -> Result<Vec<f64>, CompilerError> { pub fn render(&mut self, n: Option<u8>) -> Result<Vec<f64>, CompilerError> {
@ -417,7 +417,7 @@ impl Compiler {
fn step(self, token: impl Token) -> Result<Self, CompilerError> { fn step(self, token: impl Token) -> Result<Self, CompilerError> {
token.apply(self.0).map(Into::into) token.apply(self.0).map(Into::into)
} }
fn compile_all<'a>( fn compile_all(
self, self,
tokens: impl IntoIterator<Item = impl Token>, tokens: impl IntoIterator<Item = impl Token>,
) -> Result<Vec<f64>, CompilerError> { ) -> Result<Vec<f64>, CompilerError> {