git.delta.rocks / jrsonnet / refs/commits / 45caf79f1ab3

difftreelog

style fix clippy warnings

Yaroslav Bolyukin2021-01-25parent: #0d591aa.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
@@ -1,8 +1,8 @@
 use crate::{
 	equals,
 	error::{Error::*, Result},
-	parse_args, primitive_equals, push, throw,
-	with_state, ArrValue, Context, FuncVal, LazyVal, Val,
+	parse_args, primitive_equals, push, throw, with_state, ArrValue, Context, FuncVal, LazyVal,
+	Val,
 };
 use format::{format_arr, format_obj};
 use jrsonnet_interner::IStr;
modifiedcrates/jrsonnet-evaluator/src/lib.rsdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/lib.rs
+++ b/crates/jrsonnet-evaluator/src/lib.rs
@@ -139,7 +139,7 @@
 	e: Option<&ExprLocation>,
 	frame_desc: impl FnOnce() -> String,
 	f: impl FnOnce() -> Result<T>,
- ) -> Result<T> {
+) -> Result<T> {
 	push(e, frame_desc, f)
 }
 
@@ -340,11 +340,17 @@
 	pub fn with_tla(&self, val: Val) -> Result<Val> {
 		self.run_in_state(|| {
 			Ok(match val {
-				Val::Func(func) => push(None, || "during TLA call".to_owned(), || Ok(func.evaluate_map(
-					self.create_default_context()?,
-					&self.settings().tla_vars,
-					true,
-				)?))?,
+				Val::Func(func) => push(
+					None,
+					|| "during TLA call".to_owned(),
+					|| {
+						Ok(func.evaluate_map(
+							self.create_default_context()?,
+							&self.settings().tla_vars,
+							true,
+						)?)
+					},
+				)?,
 				v => v,
 			})
 		})
modifiedcrates/jrsonnet-evaluator/src/trace/location.rsdiffbeforeafterboth

no syntactic changes

modifiedcrates/jrsonnet-evaluator/src/trace/mod.rsdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/trace/mod.rs
+++ b/crates/jrsonnet-evaluator/src/trace/mod.rs
@@ -118,18 +118,24 @@
 			.trace()
 			.0
 			.iter()
-			.map(|el| el.location.as_ref().map(|l| {
-				use std::fmt::Write;
-				let mut resolved_path = self.resolver.resolve(&l.0);
-				// TODO: Process all trace elements first
-				let location = evaluation_state
-					.map_source_locations(&l.0, &[l.1, l.2]);
-				write!(resolved_path, ":").unwrap();
-				print_code_location(&mut resolved_path, &location[0], &location[1]).unwrap();
-				resolved_path
-			}))
+			.map(|el| {
+				el.location.as_ref().map(|l| {
+					use std::fmt::Write;
+					let mut resolved_path = self.resolver.resolve(&l.0);
+					// TODO: Process all trace elements first
+					let location = evaluation_state.map_source_locations(&l.0, &[l.1, l.2]);
+					write!(resolved_path, ":").unwrap();
+					print_code_location(&mut resolved_path, &location[0], &location[1]).unwrap();
+					resolved_path
+				})
+			})
 			.collect::<Vec<_>>();
-		let align = file_names.iter().flatten().map(|e| e.len()).max().unwrap_or(0);
+		let align = file_names
+			.iter()
+			.flatten()
+			.map(|e| e.len())
+			.max()
+			.unwrap_or(0);
 		for (i, (el, file)) in error.trace().0.iter().zip(file_names).enumerate() {
 			if i != 0 {
 				writeln!(out)?;
@@ -162,8 +168,9 @@
 				writeln!(out)?;
 			}
 			let desc = &item.desc;
-			if let Some (source) = &item.location {
-				let start_end = evaluation_state.map_source_locations(&source.0, &[source.1, source.2]);
+			if let Some(source) = &item.location {
+				let start_end =
+					evaluation_state.map_source_locations(&source.0, &[source.1, source.2]);
 
 				write!(
 					out,
@@ -174,11 +181,7 @@
 					start_end[0].column,
 				)?;
 			} else {
-				write!(
-					out,
-					"    at {}",
-					desc,
-				)?;
+				write!(out, "    at {}", desc,)?;
 			}
 		}
 		Ok(())
@@ -230,7 +233,8 @@
 		for item in trace.0.iter() {
 			let desc = &item.desc;
 			if let Some(source) = &item.location {
-				let start_end = evaluation_state.map_source_locations(&source.0, &[source.1, source.2]);
+				let start_end =
+					evaluation_state.map_source_locations(&source.0, &[source.1, source.2]);
 				self.print_snippet(
 					out,
 					&evaluation_state.get_source(&source.0).unwrap(),
modifiedcrates/jrsonnet-evaluator/src/typed.rsdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/typed.rs
+++ b/crates/jrsonnet-evaluator/src/typed.rs
@@ -16,8 +16,8 @@
 		match $value {
 			$match(v) => v,
 			_ => unreachable!(),
-		}
-	}}
+			}
+		}};
 }
 
 #[derive(Debug, Error, Clone)]