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

difftreelog

style fix clippy warnings

Yaroslav Bolyukin2021-02-20parent: #2cd889c.patch.diff
in: master

8 files changed

modifiedcrates/jrsonnet-evaluator/Cargo.tomldiffbeforeafterboth
31pathdiff = "0.2.0"31pathdiff = "0.2.0"
3232
33closure = "0.3.0"33closure = "0.3.0"
34indexmap = "1.6"
3534
36md5 = "0.7.0"35md5 = "0.7.0"
37base64 = "0.13.0"36base64 = "0.13.0"
modifiedcrates/jrsonnet-evaluator/src/builtin/mod.rsdiffbeforeafterboth
585 name: &str,585 name: &str,
586 args: &ArgsDesc,586 args: &ArgsDesc,
587) -> Result<Val> {587) -> Result<Val> {
588 if let Some(f) = BUILTINS.with(|builtins| builtins.get(name).copied()) {588 BUILTINS.with(|builtins| builtins.get(name).copied()).ok_or_else(||
589 IntrinsicNotFound(name.into())
589 return Ok(f(context, loc, args)?);590 )?(context, loc, args)
590 }
591 throw!(IntrinsicNotFound(name.into()))
592}591}
593592
modifiedcrates/jrsonnet-evaluator/src/evaluate.rsdiffbeforeafterboth
222 let future_this = FutureObjValue::new();222 let future_this = FutureObjValue::new();
223 let context_creator = context_creator!(223 let context_creator = context_creator!(
224 closure!(clone context, clone new_bindings, |this: Option<ObjValue>, super_obj: Option<ObjValue>| {224 closure!(clone context, clone new_bindings, |this: Option<ObjValue>, super_obj: Option<ObjValue>| {
225 Ok(context.clone().extend_unbound(225 context.clone().extend_unbound(
226 new_bindings.clone().unwrap(),226 new_bindings.clone().unwrap(),
227 context.dollar().clone().or_else(||this.clone()),227 context.dollar().clone().or_else(||this.clone()),
228 Some(this.unwrap()),228 Some(this.unwrap()),
229 super_obj229 super_obj
230 )?)230 )
231 })231 })
232 );232 );
233 {233 {
327 let new_bindings = FutureNewBindings::new();327 let new_bindings = FutureNewBindings::new();
328 let context_creator = context_creator!(328 let context_creator = context_creator!(
329 closure!(clone context, clone new_bindings, |this: Option<ObjValue>, super_obj: Option<ObjValue>| {329 closure!(clone context, clone new_bindings, |this: Option<ObjValue>, super_obj: Option<ObjValue>| {
330 Ok(context.clone().extend_unbound(330 context.clone().extend_unbound(
331 new_bindings.clone().unwrap(),331 new_bindings.clone().unwrap(),
332 context.dollar().clone().or_else(||this.clone()),332 context.dollar().clone().or_else(||this.clone()),
333 None,333 None,
334 super_obj334 super_obj
335 )?)335 )
336 })336 })
337 );337 );
338 let mut bindings: HashMap<IStr, LazyBinding> = HashMap::new();338 let mut bindings: HashMap<IStr, LazyBinding> = HashMap::new();
439 Var(name) => push(439 Var(name) => push(
440 loc.as_ref(),440 loc.as_ref(),
441 || format!("variable <{}>", name),441 || format!("variable <{}>", name),
442 || Ok(context.binding(name.clone())?.evaluate()?),442 || context.binding(name.clone())?.evaluate(),
443 )?,443 )?,
444 Index(value, index) => {444 Index(value, index) => {
445 match (evaluate(context.clone(), value)?, evaluate(context, index)?) {445 match (evaluate(context.clone(), value)?, evaluate(context, index)?) {
modifiedcrates/jrsonnet-evaluator/src/lib.rsdiffbeforeafterboth
344 None,344 None,
345 || "during TLA call".to_owned(),345 || "during TLA call".to_owned(),
346 || {346 || {
347 Ok(func.evaluate_map(347 func.evaluate_map(
348 self.create_default_context()?,348 self.create_default_context()?,
349 &self.settings().tla_vars,349 &self.settings().tla_vars,
350 true,350 true,
351 )?)351 )
352 },352 },
353 )?,353 )?,
354 v => v,354 v => v,
432 Ok(self.settings().import_resolver.resolve_file(from, path)?)432 Ok(self.settings().import_resolver.resolve_file(from, path)?)
433 }433 }
434 pub fn load_file_contents(&self, path: &PathBuf) -> Result<IStr> {434 pub fn load_file_contents(&self, path: &PathBuf) -> Result<IStr> {
435 Ok(self.settings().import_resolver.load_file_contents(path)?)435 self.settings().import_resolver.load_file_contents(path)
436 }436 }
437437
438 pub fn import_resolver(&self) -> Ref<dyn ImportResolver> {438 pub fn import_resolver(&self) -> Ref<dyn ImportResolver> {
modifiedcrates/jrsonnet-evaluator/src/typed.rsdiffbeforeafterboth
177 None,177 None,
178 || format!("array index {}", i),178 || format!("array index {}", i),
179 || ValuePathItem::Index(i as u64),179 || ValuePathItem::Index(i as u64),
180 || Ok(elem_type.check(&item.clone()?)?),180 || elem_type.check(&item.clone()?),
181 )?;181 )?;
182 }182 }
183 Ok(())183 Ok(())
191 None,191 None,
192 || format!("array index {}", i),192 || format!("array index {}", i),
193 || ValuePathItem::Index(i as u64),193 || ValuePathItem::Index(i as u64),
194 || Ok(elem_type.check(&item.clone()?)?),194 || elem_type.check(&item.clone()?),
195 )?;195 )?;
196 }196 }
197 Ok(())197 Ok(())
modifiedcrates/jrsonnet-evaluator/src/val.rsdiffbeforeafterboth
537 let ctx = s537 let ctx = s
538 .create_default_context()?538 .create_default_context()?
539 .with_var("__tmp__to_json__".into(), self.clone());539 .with_var("__tmp__to_json__".into(), self.clone());
540 Ok(evaluate(540 evaluate(
541 ctx,541 ctx,
542 &el!(Expr::Apply(542 &el!(Expr::Apply(
543 el!(Expr::Index(543 el!(Expr::Index(
558 false558 false
559 )),559 )),
560 )?560 )?
561 .try_cast_str("to json")?)561 .try_cast_str("to json")
562 })562 })
563 }563 }
564}564}
modifiedcrates/jrsonnet-parser/src/expr.rsdiffbeforeafterboth
32 Unhide,32 Unhide,
33}33}
34
35impl Visibility {
36 pub fn is_visible(&self) -> bool {
37 matches!(self, Self::Normal | Self::Unhide)
38 }
39}
3440
35#[cfg_attr(feature = "serialize", derive(Serialize))]41#[cfg_attr(feature = "serialize", derive(Serialize))]
36#[cfg_attr(feature = "deserialize", derive(Deserialize))]42#[cfg_attr(feature = "deserialize", derive(Deserialize))]
modifiedcrates/jrsonnet-parser/src/lib.rsdiffbeforeafterboth

no syntactic changes