difftreelog
fix clippy warnings
in: master
5 files changed
crates/jrsonnet-evaluator/src/evaluate.rsdiffbeforeafterboth--- a/crates/jrsonnet-evaluator/src/evaluate.rs
+++ b/crates/jrsonnet-evaluator/src/evaluate.rs
@@ -147,8 +147,8 @@
Ok(match (a, op, b) {
(a, BinaryOpType::Add, b) => evaluate_add_op(a, b)?,
- (a, BinaryOpType::Eq, b) => Val::Bool(equals(&a, &b)?),
- (a, BinaryOpType::Neq, b) => Val::Bool(!equals(&a, &b)?),
+ (a, BinaryOpType::Eq, b) => Val::Bool(equals(a, b)?),
+ (a, BinaryOpType::Neq, b) => Val::Bool(!equals(a, b)?),
(Val::Str(v1), BinaryOpType::Mul, Val::Num(v2)) => Val::Str(v1.repeat(*v2 as usize).into()),
@@ -578,7 +578,7 @@
}
Intrinsic(name) => Val::Func(Rc::new(FuncVal::Intrinsic(name.clone()))),
AssertExpr(assert, returned) => {
- evaluate_assert(context.clone(), &assert)?;
+ evaluate_assert(context.clone(), assert)?;
evaluate(context, returned)?
}
ErrorStmt(e) => push(
crates/jrsonnet-evaluator/src/integrations/serde.rsdiffbeforeafterboth--- a/crates/jrsonnet-evaluator/src/integrations/serde.rs
+++ b/crates/jrsonnet-evaluator/src/integrations/serde.rs
@@ -1,7 +1,6 @@
use crate::{
- Context,
error::{Error::*, LocError, Result},
- throw, LazyBinding, LazyVal, ObjMember, ObjValue, Val,
+ throw, Context, LazyBinding, LazyVal, ObjMember, ObjValue, Val,
};
use jrsonnet_parser::Visibility;
use rustc_hash::FxHasher;
@@ -77,7 +76,12 @@
},
);
}
- Self::Obj(ObjValue::new(Context::new(), None, Rc::new(entries), Rc::new(Vec::new())))
+ Self::Obj(ObjValue::new(
+ Context::new(),
+ None,
+ Rc::new(entries),
+ Rc::new(Vec::new()),
+ ))
}
}
}
crates/jrsonnet-evaluator/src/lib.rsdiffbeforeafterboth--- a/crates/jrsonnet-evaluator/src/lib.rs
+++ b/crates/jrsonnet-evaluator/src/lib.rs
@@ -1,6 +1,9 @@
#![cfg_attr(feature = "unstable", feature(stmt_expr_attributes))]
#![warn(clippy::all, clippy::nursery)]
-#![allow(macro_expanded_macro_exports_accessed_by_absolute_paths, clippy::ptr_arg)]
+#![allow(
+ macro_expanded_macro_exports_accessed_by_absolute_paths,
+ clippy::ptr_arg
+)]
mod builtin;
mod ctx;
@@ -390,7 +393,7 @@
loc_data: true,
},
)
- .map_err(|e| ImportSyntaxError {
+ .map_err(|e| ImportSyntaxError {
path: source.clone(),
source_code: code.clone(),
error: Box::new(e),
@@ -998,9 +1001,10 @@
let state = EvaluationState::default();
state.with_stdlib();
- let error = state.evaluate_snippet_raw(
- Rc::new(PathBuf::from("issue40.jsonnet")),
- r#"
+ let error = state
+ .evaluate_snippet_raw(
+ Rc::new(PathBuf::from("issue40.jsonnet")),
+ r#"
local conf = {
n: ""
};
@@ -1010,8 +1014,10 @@
};
std.manifestJsonEx(result, "")
- "#.into(),
- ).unwrap_err();
+ "#
+ .into(),
+ )
+ .unwrap_err();
assert_eq!(error.error().to_string(), "assert failed: is number");
}
}
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.rsdiffbeforeafterboth--- a/crates/jrsonnet-evaluator/src/val.rs
+++ b/crates/jrsonnet-evaluator/src/val.rs
@@ -124,7 +124,7 @@
for p in handler.params.0.iter() {
out_args.push(args.binding(p.0.clone())?.evaluate()?);
}
- Ok(handler.call(loc.clone().map(|l| l.0.clone()), &out_args)?)
+ Ok(handler.call(loc.map(|l| l.0.clone()), &out_args)?)
}
}
}