git.delta.rocks / jrsonnet / refs/commits / 6d535da7fe1f

difftreelog

style fix clippy warnings

Yaroslav Bolyukin2021-07-06parent: #e668bf3.patch.diff
in: master

5 files changed

modifiedcrates/jrsonnet-evaluator/src/builtin/mod.rsdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/builtin/mod.rs
+++ b/crates/jrsonnet-evaluator/src/builtin/mod.rs
@@ -221,7 +221,7 @@
 		3, step: ty!((number | null));
 	], {
 		std_slice(
-			indexable.to_indexable()?,
+			indexable.into_indexable()?,
 			index.try_cast_nullable_num("index")?.map(|v| v as usize),
 			end.try_cast_nullable_num("end")?.map(|v| v as usize),
 			step.try_cast_nullable_num("step")?.map(|v| v as usize),
modifiedcrates/jrsonnet-evaluator/src/evaluate/mod.rsdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/evaluate/mod.rs
+++ b/crates/jrsonnet-evaluator/src/evaluate/mod.rs
@@ -687,7 +687,7 @@
 				desc: &'static str,
 			) -> Result<Option<usize>> {
 				Ok(match expr {
-					Some(s) => evaluate(context.clone(), &s)?
+					Some(s) => evaluate(context.clone(), s)?
 						.try_cast_nullable_num(desc)?
 						.map(|v| v as usize),
 					None => None,
@@ -698,7 +698,7 @@
 			let end = parse_num(&context, desc.end.as_ref(), "end")?;
 			let step = parse_num(&context, desc.step.as_ref(), "step")?;
 
-			std_slice(indexable.to_indexable()?, start, end, step)?
+			std_slice(indexable.into_indexable()?, start, end, step)?
 		}
 		Import(path) => {
 			let tmp = loc
modifiedcrates/jrsonnet-evaluator/src/integrations/serde.rsdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/integrations/serde.rs
+++ b/crates/jrsonnet-evaluator/src/integrations/serde.rs
@@ -47,7 +47,7 @@
 			Value::Number(n) => Self::Num(n.as_f64().expect("as f64")),
 			Value::String(s) => Self::Str((s as &str).into()),
 			Value::Array(a) => {
-				let mut out: Vec<Val> = Vec::with_capacity(a.len());
+				let mut out: Vec<Self> = Vec::with_capacity(a.len());
 				for v in a {
 					out.push(v.into());
 				}
@@ -58,7 +58,7 @@
 				for (k, v) in o {
 					builder.member((k as &str).into()).value(v.into());
 				}
-				Val::Obj(builder.build())
+				Self::Obj(builder.build())
 			}
 		}
 	}
modifiedcrates/jrsonnet-evaluator/src/obj.rsdiffbeforeafterboth
322 ObjValue::new(self.super_obj, Gc::new(self.map), Gc::new(self.assertions))322 ObjValue::new(self.super_obj, Gc::new(self.map), Gc::new(self.assertions))
323 }323 }
324}324}
325impl Default for ObjValueBuilder {
326 fn default() -> Self {
327 Self::with_capacity(0)
328 }
329}
325330
326#[must_use = "value not added unless binding() was called"]331#[must_use = "value not added unless binding() was called"]
327pub struct ObjMemberBuilder<'v> {332pub struct ObjMemberBuilder<'v> {
332 location: Option<ExprLocation>,337 location: Option<ExprLocation>,
333}338}
334339
340#[allow(clippy::missing_const_for_fn)]
335impl<'v> ObjMemberBuilder<'v> {341impl<'v> ObjMemberBuilder<'v> {
336 pub fn with_add(mut self, add: bool) -> Self {342 pub const fn with_add(mut self, add: bool) -> Self {
337 self.add = add;343 self.add = add;
338 self344 self
339 }345 }
modifiedcrates/jrsonnet-evaluator/src/val.rsdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/val.rs
+++ b/crates/jrsonnet-evaluator/src/val.rs
@@ -571,7 +571,7 @@
 			.try_cast_str("to json")
 		})
 	}
-	pub fn to_indexable(self) -> Result<IndexableVal> {
+	pub fn into_indexable(self) -> Result<IndexableVal> {
 		Ok(match self {
 			Val::Str(s) => IndexableVal::Str(s),
 			Val::Arr(arr) => IndexableVal::Arr(arr),