git.delta.rocks / jrsonnet / refs/commits / 18dc4db46973

difftreelog

fix experimental features build

Yaroslav Bolyukin2024-06-18parent: #1086a51.patch.diff
in: master

3 files changed

modifiedcmds/jrsonnet/src/main.rsdiffbeforeafterboth
--- a/cmds/jrsonnet/src/main.rs
+++ b/cmds/jrsonnet/src/main.rs
@@ -186,8 +186,12 @@
 	};
 
 	let tla = opts.tla.tla_opts()?;
-	#[allow(unused_mut)]
-	let mut val = apply_tla(s, &tla, val)?;
+	#[allow(
+		// It is not redundant/unused in exp-apply
+		unused_mut,
+		clippy::redundant_clone,
+	)]
+	let mut val = apply_tla(s.clone(), &tla, val)?;
 
 	#[cfg(feature = "exp-apply")]
 	for apply in opts.input.exp_apply {
modifiedcrates/jrsonnet-stdlib/src/arrays.rsdiffbeforeafterboth
--- a/crates/jrsonnet-stdlib/src/arrays.rs
+++ b/crates/jrsonnet-stdlib/src/arrays.rs
@@ -70,7 +70,13 @@
 #[builtin]
 pub fn builtin_map_with_key(func: FuncVal, obj: ObjValue) -> Result<ObjValue> {
 	let mut out = ObjValueBuilder::new();
-	for (k, v) in obj.iter() {
+	for (k, v) in obj.iter(
+		// Makes sense mapped object should be ordered the same way, should not break anything when the output is not ordered (the default).
+		// The thrown error might be different, but jsonnet
+		// does not specify the evaluation order.
+		#[cfg(feature = "exp-preserve-order")]
+		true,
+	) {
 		let v = v?;
 		out.field(k.clone())
 			.value(func.evaluate_simple(&(k, v), false)?);
modifiedcrates/jrsonnet-stdlib/src/misc.rsdiffbeforeafterboth
147 if equals(&a, &b)? {147 if equals(&a, &b)? {
148 return Ok(true);148 return Ok(true);
149 }149 }
150 // TODO: Use debug output format
150 let format = JsonFormat::std_to_json(" ".to_owned(), "\n", ": ");151 let format = JsonFormat::std_to_json(
152 " ".to_owned(),
153 "\n",
154 ": ",
155 #[cfg(feature = "exp-preserve-order")]
156 true,
157 );
151 let a = a.manifest(&format).description("<a> manifestification")?;158 let a = a.manifest(&format).description("<a> manifestification")?;
152 let b = b.manifest(&format).description("<b> manifestification")?;159 let b = b.manifest(&format).description("<b> manifestification")?;
163 };170 };
164 let target_fields = target.fields().into_iter().collect::<BTreeSet<IStr>>();171 let target_fields = target
172 .fields(
173 // FIXME: Makes no sense to preserve order for BTreeSet, it would be better to use IndexSet here?
174 // But IndexSet won't allow fast ordered union...
175 // // Makes sense to preserve source ordering where possible.
176 // // May affect evaluation order, but it is not specified by jsonnet spec.
177 // #[cfg(feature = "exp-preserve-order")]
178 // true,
179 #[cfg(feature = "exp-preserve-order")]
180 false,
181 )
182 .into_iter()
183 .collect::<BTreeSet<IStr>>();
165 let patch_fields = patch.fields().into_iter().collect::<BTreeSet<IStr>>();184 let patch_fields = patch
185 .fields(
186 // No need to look at the patch field order, I think?
187 // New fields (that will be appended at the end) will be alphabeticaly-ordered,
188 // but it is fine for jsonpatch, I don't think people write jsonpatch in jsonnet,
189 // when they can use mixins.
190 #[cfg(feature = "exp-preserve-order")]
191 false,
192 )
193 .into_iter()
194 .collect::<BTreeSet<IStr>>();