git.delta.rocks / jrsonnet / refs/commits / ee371c2d9f29

difftreelog

fix clippy warnings

Yaroslav Bolyukin2021-05-23parent: #51b072d.patch.diff
in: master

5 files changed

modifiedcrates/jrsonnet-evaluator/src/evaluate.rsdiffbeforeafterboth
147 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)?,
149149
150 (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)?),
152152
153 (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()),
154154
578 }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(
modifiedcrates/jrsonnet-evaluator/src/integrations/serde.rsdiffbeforeafterboth
1use 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;
modifiedcrates/jrsonnet-evaluator/src/lib.rsdiffbeforeafterboth

no syntactic changes

modifiedcrates/jrsonnet-evaluator/src/obj.rsdiffbeforeafterboth
1use 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 }
177197
178 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 }
182202
211 )
187 }212 }
188213
189 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());
192217
modifiedcrates/jrsonnet-evaluator/src/val.rsdiffbeforeafterboth
124 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 }