git.delta.rocks / jrsonnet / refs/commits / 4f2e8db91a47

difftreelog

style fix clippy warnings

Yaroslav Bolyukin2024-06-18parent: #3048d02.patch.diff
in: master

8 files changed

modifiedcrates/jrsonnet-evaluator/src/arr/mod.rsdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/arr/mod.rs
+++ b/crates/jrsonnet-evaluator/src/arr/mod.rs
@@ -1,7 +1,4 @@
-use std::{
-	any::Any,
-	num::{NonZeroU32, NonZeroUsize},
-};
+use std::{any::Any, num::NonZeroU32};
 
 use jrsonnet_gcmodule::{Cc, Trace};
 use jrsonnet_interner::IBytes;
modifiedcrates/jrsonnet-evaluator/src/evaluate/destructure.rsdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/evaluate/destructure.rs
+++ b/crates/jrsonnet-evaluator/src/evaluate/destructure.rs
@@ -110,7 +110,11 @@
 						fn get(self: Box<Self>) -> Result<Self::Output> {
 							let full = self.full.evaluate()?;
 							let to = full.len() - self.end;
-							Ok(Val::Arr(full.slice(Some(self.start as i32), Some(to as i32), None)))
+							Ok(Val::Arr(full.slice(
+								Some(self.start as i32),
+								Some(to as i32),
+								None,
+							)))
 						}
 					}
 
modifiedcrates/jrsonnet-evaluator/src/val.rsdiffbeforeafterboth
2 cell::RefCell,2 cell::RefCell,
3 fmt::{self, Debug, Display},3 fmt::{self, Debug, Display},
4 mem::replace,4 mem::replace,
5 num::{NonZeroU32, NonZeroUsize},5 num::NonZeroU32,
6 rc::Rc,6 rc::Rc,
7};7};
88
modifiedcrates/jrsonnet-macros/src/lib.rsdiffbeforeafterboth
--- a/crates/jrsonnet-macros/src/lib.rs
+++ b/crates/jrsonnet-macros/src/lib.rs
@@ -218,8 +218,7 @@
 	item: proc_macro::TokenStream,
 ) -> proc_macro::TokenStream {
 	let attr = parse_macro_input!(attr as BuiltinAttrs);
-	let item_fn = item.clone();
-	let item_fn: ItemFn = parse_macro_input!(item_fn);
+	let item_fn = parse_macro_input!(item as ItemFn);
 
 	match builtin_inner(attr, item_fn) {
 		Ok(v) => v.into(),
modifiedcrates/jrsonnet-stdlib/src/manifest/toml.rsdiffbeforeafterboth
--- a/crates/jrsonnet-stdlib/src/manifest/toml.rs
+++ b/crates/jrsonnet-stdlib/src/manifest/toml.rs
@@ -4,7 +4,7 @@
 	bail,
 	manifest::{escape_string_json_buf, ManifestFormat},
 	val::ArrValue,
-	IStr, ObjValue, Result, ResultExt, Val, State,
+	IStr, ObjValue, Result, ResultExt, State, Val,
 };
 
 pub struct TomlFormat<'s> {
modifiedcrates/jrsonnet-stdlib/src/manifest/xml.rsdiffbeforeafterboth
--- a/crates/jrsonnet-stdlib/src/manifest/xml.rs
+++ b/crates/jrsonnet-stdlib/src/manifest/xml.rs
@@ -1,9 +1,9 @@
 use jrsonnet_evaluator::{
 	bail,
 	manifest::{ManifestFormat, ToStringFormat},
-	typed::{ComplexValType, Either2, Either4, Typed, ValType},
-	val::{ArrValue, IndexableVal},
-	Either, ObjValue, Result, ResultExt, Val, State,
+	typed::{ComplexValType, Either2, Typed, ValType},
+	val::ArrValue,
+	Either, ObjValue, Result, ResultExt, State, Val,
 };
 
 pub struct XmlJsonmlFormat {
@@ -39,20 +39,20 @@
 
 	fn from_untyped(untyped: Val) -> Result<Self> {
 		let val = <Either![ArrValue, String]>::from_untyped(untyped)
-			.with_description(|| format!("parsing JSONML value (an array or string)"))?;
+			.description("parsing JSONML value (an array or string)")?;
 		let arr = match val {
 			Either2::A(a) => a,
 			Either2::B(s) => return Ok(Self::String(s)),
 		};
-		if arr.len() < 1 {
+		if arr.is_empty() {
 			bail!("JSONML value should have tag (array length should be >=1)");
 		};
 		let tag = String::from_untyped(
 			arr.get(0)
-				.with_description(|| "getting JSONML tag")?
+				.description("getting JSONML tag")?
 				.expect("length checked"),
 		)
-		.with_description(|| format!("parsing JSONML tag"))?;
+		.description("parsing JSONML tag")?;
 
 		let (has_attrs, attrs) = if arr.len() >= 2 {
 			let maybe_attrs = arr
@@ -71,7 +71,7 @@
 			tag,
 			attrs,
 			children: State::push_description(
-				|| format!("parsing children"),
+				|| "parsing children".to_owned(),
 				|| {
 					Typed::from_untyped(Val::Arr(arr.slice(
 						Some(if has_attrs { 2 } else { 1 }),
@@ -100,7 +100,7 @@
 		} => {
 			let has_children = !children.is_empty();
 			buf.push('<');
-			buf.push_str(&tag);
+			buf.push_str(tag);
 			attrs.run_assertions()?;
 			for (key, value) in attrs.iter(
 				// Not much sense to preserve order here
@@ -125,12 +125,12 @@
 			}
 			buf.push('>');
 			for child in children {
-				manifest_jsonml(&child, buf, opts)?;
+				manifest_jsonml(child, buf, opts)?;
 			}
 			if has_children || opts.force_closing {
 				buf.push('<');
 				buf.push('/');
-				buf.push_str(&tag);
+				buf.push_str(tag);
 				buf.push('>');
 			}
 			Ok(())
@@ -177,8 +177,8 @@
 	}
 	if !found {
 		// No match - no escapes required
-		out.push_str(&str);
+		out.push_str(str);
 		return;
 	}
-	out.push_str(&remaining);
+	out.push_str(remaining);
 }
modifiedcrates/jrsonnet-stdlib/src/misc.rsdiffbeforeafterboth
--- a/crates/jrsonnet-stdlib/src/misc.rs
+++ b/crates/jrsonnet-stdlib/src/misc.rs
@@ -28,8 +28,7 @@
 	o: ObjValue,
 	f: IStr,
 	default: Option<Thunk<Val>>,
-	#[default(true)]
-	inc_hidden: bool,
+	#[default(true)] inc_hidden: bool,
 ) -> Result<Val> {
 	let do_default = move || {
 		let Some(default) = default else {
modifiedcrates/jrsonnet-stdlib/src/objects.rsdiffbeforeafterboth
--- a/crates/jrsonnet-stdlib/src/objects.rs
+++ b/crates/jrsonnet-stdlib/src/objects.rs
@@ -57,8 +57,7 @@
 	o: ObjValue,
 	include_hidden: bool,
 
-	#[cfg(feature = "exp-preserve-order")]
-	preserve_order: bool,
+	#[cfg(feature = "exp-preserve-order")] preserve_order: bool,
 ) -> ArrValue {
 	o.values_ex(
 		include_hidden,
@@ -101,8 +100,7 @@
 	o: ObjValue,
 	include_hidden: bool,
 
-	#[cfg(feature = "exp-preserve-order")]
-	preserve_order: bool,
+	#[cfg(feature = "exp-preserve-order")] preserve_order: bool,
 ) -> ArrValue {
 	o.key_values_ex(
 		include_hidden,