difftreelog
fix clippy warnings
in: master
5 files changed
crates/jrsonnet-evaluator/src/evaluate.rsdiffbeforeafterboth147 Ok(match (a, op, b) {147 Ok(match (a, op, b) {148 (a, BinaryOpType::Add, b) => evaluate_add_op(a, b)?,148 (a, BinaryOpType::Add, b) => evaluate_add_op(a, b)?,149149150 (a, BinaryOpType::Eq, b) => Val::Bool(equals(&a, &b)?),150 (a, BinaryOpType::Eq, b) => Val::Bool(equals(a, b)?),151 (a, BinaryOpType::Neq, b) => Val::Bool(!equals(&a, &b)?),151 (a, BinaryOpType::Neq, b) => Val::Bool(!equals(a, b)?),152152153 (Val::Str(v1), BinaryOpType::Mul, Val::Num(v2)) => Val::Str(v1.repeat(*v2 as usize).into()),153 (Val::Str(v1), BinaryOpType::Mul, Val::Num(v2)) => Val::Str(v1.repeat(*v2 as usize).into()),154154578 }578 }579 Intrinsic(name) => Val::Func(Rc::new(FuncVal::Intrinsic(name.clone()))),579 Intrinsic(name) => Val::Func(Rc::new(FuncVal::Intrinsic(name.clone()))),580 AssertExpr(assert, returned) => {580 AssertExpr(assert, returned) => {581 evaluate_assert(context.clone(), &assert)?;581 evaluate_assert(context.clone(), assert)?;582 evaluate(context, returned)?582 evaluate(context, returned)?583 }583 }584 ErrorStmt(e) => push(584 ErrorStmt(e) => push(crates/jrsonnet-evaluator/src/integrations/serde.rsdiffbeforeafterboth1use crate::{1use crate::{2 Context,3 error::{Error::*, LocError, Result},2 error::{Error::*, LocError, Result},4 throw, LazyBinding, LazyVal, ObjMember, ObjValue, Val,3 throw, Context, LazyBinding, LazyVal, ObjMember, ObjValue, Val,5};4};6use jrsonnet_parser::Visibility;5use jrsonnet_parser::Visibility;7use rustc_hash::FxHasher;6use rustc_hash::FxHasher;crates/jrsonnet-evaluator/src/lib.rsdiffbeforeafterbothno syntactic changes
crates/jrsonnet-evaluator/src/obj.rsdiffbeforeafterboth1use crate::{Context, evaluate_add_op, evaluate_assert, LazyBinding, Result, Val};1use crate::{evaluate_add_op, evaluate_assert, Context, LazyBinding, Result, Val};2use jrsonnet_interner::IStr;2use jrsonnet_interner::IStr;3use jrsonnet_parser::{ExprLocation, LocExpr, Visibility, AssertStmt};3use jrsonnet_parser::{AssertStmt, ExprLocation, Visibility};4use rustc_hash::{FxHashMap, FxHashSet};4use rustc_hash::{FxHashMap, FxHashSet};5use std::hash::{Hash, Hasher};5use std::hash::{Hash, Hasher};6use std::{cell::RefCell, fmt::Debug, hash::BuildHasherDefault, rc::Rc};6use std::{cell::RefCell, fmt::Debug, hash::BuildHasherDefault, rc::Rc};176 }196 }177197178 pub fn get(&self, key: IStr) -> Result<Option<Val>> {198 pub fn get(&self, key: IStr) -> Result<Option<Val>> {179 self.run_assertions(self.0.this_obj.as_ref().unwrap_or(self))?;199 self.run_assertions()?;180 self.get_raw(key, self.0.this_obj.as_ref())200 self.get_raw(key, self.0.this_obj.as_ref())181 }201 }182202211 )187 }212 }188213189 pub fn get_raw(&self, key: IStr, real_this: Option<&Self>) -> Result<Option<Val>> {214 fn get_raw(&self, key: IStr, real_this: Option<&Self>) -> Result<Option<Val>> {190 let real_this = real_this.unwrap_or(self);215 let real_this = real_this.unwrap_or(self);191 let cache_key = (key.clone(), real_this.clone());216 let cache_key = (key.clone(), real_this.clone());192217crates/jrsonnet-evaluator/src/val.rsdiffbeforeafterboth124 for p in handler.params.0.iter() {124 for p in handler.params.0.iter() {125 out_args.push(args.binding(p.0.clone())?.evaluate()?);125 out_args.push(args.binding(p.0.clone())?.evaluate()?);126 }126 }127 Ok(handler.call(loc.clone().map(|l| l.0.clone()), &out_args)?)127 Ok(handler.call(loc.map(|l| l.0.clone()), &out_args)?)128 }128 }129 }129 }130 }130 }