git.delta.rocks / jrsonnet / refs/commits / 5df60b8b674f

difftreelog

style fix clippy warnings

rvmlxxrnYaroslav Bolyukin2026-03-21parent: #ac5b435.patch.diff
in: master

36 files changed

modifiedbindings/jsonnet/src/native.rsdiffbeforeafterboth
--- a/bindings/jsonnet/src/native.rs
+++ b/bindings/jsonnet/src/native.rs
@@ -43,7 +43,7 @@
 		}
 		n_args.push(None);
 		let mut success = 1;
-		let v = unsafe { (self.cb)(self.ctx, n_args.as_ptr().cast(), &mut success) };
+		let v = unsafe { (self.cb)(self.ctx, n_args.as_ptr().cast(), &raw mut success) };
 		let v = unsafe { *Box::from_raw(v) };
 		if success == 1 {
 			Ok(v)
modifiedcrates/jrsonnet-cli/src/tla.rsdiffbeforeafterboth
--- a/crates/jrsonnet-cli/src/tla.rs
+++ b/crates/jrsonnet-cli/src/tla.rs
@@ -7,6 +7,7 @@
 
 #[derive(Parser)]
 #[clap(next_help_heading = "TOP LEVEL ARGUMENTS")]
+#[allow(clippy::struct_field_names)]
 pub struct TlaOpts {
 	/// Add top level string argument.
 	/// Top level arguments will be passed to function before manifestification stage.
modifiedcrates/jrsonnet-evaluator/src/arr/mod.rsdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/arr/mod.rs
+++ b/crates/jrsonnet-evaluator/src/arr/mod.rs
@@ -77,7 +77,7 @@
 			let i = i?;
 			if filter(&i)? {
 				out.push(i);
-			};
+			}
 		}
 		Ok(Self::eager(out))
 	}
modifiedcrates/jrsonnet-evaluator/src/arr/spec.rsdiffbeforeafterboth
before · crates/jrsonnet-evaluator/src/arr/spec.rs
1use std::rc::Rc;2use std::{any::Any, cell::RefCell, fmt::Debug, mem::replace};34use jrsonnet_gcmodule::{Cc, Trace};5use jrsonnet_interner::{IBytes, IStr};6use jrsonnet_parser::{Expr, Spanned};78use super::ArrValue;9use crate::{10	error::ErrorKind::InfiniteRecursionDetected, evaluate, function::FuncVal, typed::Typed,11	val::ThunkValue, Context, Error, ObjValue, Result, Thunk, Val,12};1314pub trait ArrayLike: Any + Trace + Debug {15	fn len(&self) -> usize;16	fn is_empty(&self) -> bool {17		self.len() == 018	}19	fn get(&self, index: usize) -> Result<Option<Val>>;20	fn get_lazy(&self, index: usize) -> Option<Thunk<Val>>;21	fn get_cheap(&self, index: usize) -> Option<Val>;2223	fn is_cheap(&self) -> bool;24}2526#[derive(Debug, Trace)]27pub struct SliceArray {28	pub(crate) inner: ArrValue,29	pub(crate) from: u32,30	pub(crate) to: u32,31	pub(crate) step: u32,32}3334impl SliceArray {35	fn map_idx(&self, index: usize) -> usize {36		self.from as usize + self.step as usize * index37	}38}39impl ArrayLike for SliceArray {40	fn len(&self) -> usize {41		((self.to - self.from + self.step - 1) / self.step) as usize42	}4344	fn get(&self, index: usize) -> Result<Option<Val>> {45		self.inner.get(self.map_idx(index))46	}4748	fn get_lazy(&self, index: usize) -> Option<Thunk<Val>> {49		self.inner.get_lazy(self.map_idx(index))50	}5152	fn get_cheap(&self, index: usize) -> Option<Val> {53		self.inner.get_cheap(self.map_idx(index))54	}55	fn is_cheap(&self) -> bool {56		self.inner.is_cheap()57	}58}5960#[derive(Trace, Debug)]61pub struct CharArray(pub Vec<char>);62impl ArrayLike for CharArray {63	fn len(&self) -> usize {64		self.0.len()65	}6667	fn get(&self, index: usize) -> Result<Option<Val>> {68		Ok(self.get_cheap(index))69	}7071	fn get_lazy(&self, index: usize) -> Option<Thunk<Val>> {72		self.get_cheap(index).map(Thunk::evaluated)73	}7475	fn get_cheap(&self, index: usize) -> Option<Val> {76		self.0.get(index).map(|v| Val::string(*v))77	}78	fn is_cheap(&self) -> bool {79		true80	}81}8283#[derive(Trace, Debug)]84pub struct BytesArray(pub IBytes);85impl ArrayLike for BytesArray {86	fn len(&self) -> usize {87		self.0.len()88	}8990	fn get(&self, index: usize) -> Result<Option<Val>> {91		Ok(self.get_cheap(index))92	}9394	fn get_lazy(&self, index: usize) -> Option<Thunk<Val>> {95		self.get_cheap(index).map(Thunk::evaluated)96	}9798	fn get_cheap(&self, index: usize) -> Option<Val> {99		self.0.get(index).map(|v| Val::Num((*v).into()))100	}101	fn is_cheap(&self) -> bool {102		true103	}104}105106#[derive(Debug, Trace, Clone)]107enum ArrayThunk {108	Computed(Val),109	Errored(Error),110	Waiting,111	Pending,112}113114#[derive(Debug, Trace, Clone)]115pub struct ExprArray {116	ctx: Context,117	src: Rc<Vec<Spanned<Expr>>>,118	cached: Cc<RefCell<Vec<ArrayThunk>>>,119}120impl ExprArray {121	pub fn new(ctx: Context, src: Rc<Vec<Spanned<Expr>>>) -> Self {122		Self {123			ctx,124			cached: Cc::new(RefCell::new(vec![ArrayThunk::Waiting; src.len()])),125			src,126		}127	}128}129impl ArrayLike for ExprArray {130	fn len(&self) -> usize {131		self.cached.borrow().len()132	}133	fn get(&self, index: usize) -> Result<Option<Val>> {134		if index >= self.len() {135			return Ok(None);136		}137		match &self.cached.borrow()[index] {138			ArrayThunk::Computed(c) => return Ok(Some(c.clone())),139			ArrayThunk::Errored(e) => return Err(e.clone()),140			ArrayThunk::Pending => return Err(InfiniteRecursionDetected.into()),141			ArrayThunk::Waiting => {}142		};143144		let ArrayThunk::Waiting =145			replace(&mut self.cached.borrow_mut()[index], ArrayThunk::Pending)146		else {147			unreachable!()148		};149150		let new_value = match evaluate(self.ctx.clone(), &self.src[index]) {151			Ok(v) => v,152			Err(e) => {153				self.cached.borrow_mut()[index] = ArrayThunk::Errored(e.clone());154				return Err(e);155			}156		};157		self.cached.borrow_mut()[index] = ArrayThunk::Computed(new_value.clone());158		Ok(Some(new_value))159	}160	fn get_lazy(&self, index: usize) -> Option<Thunk<Val>> {161		if index >= self.len() {162			return None;163		}164		match &self.cached.borrow()[index] {165			ArrayThunk::Computed(c) => return Some(Thunk::evaluated(c.clone())),166			ArrayThunk::Errored(e) => return Some(Thunk::errored(e.clone())),167			ArrayThunk::Waiting | ArrayThunk::Pending => {}168		};169170		#[derive(Trace)]171		struct ExprArrThunk {172			expr: ExprArray,173			index: usize,174		}175		impl ThunkValue for ExprArrThunk {176			type Output = Val;177178			fn get(&self) -> Result<Self::Output> {179				self.expr180					.get(self.index)181					.transpose()182					.expect("index checked")183			}184		}185186		Some(Thunk::new(ExprArrThunk {187			expr: self.clone(),188			index,189		}))190	}191	fn get_cheap(&self, _index: usize) -> Option<Val> {192		None193	}194	fn is_cheap(&self) -> bool {195		false196	}197}198199#[derive(Trace, Debug)]200pub struct ExtendedArray {201	pub a: ArrValue,202	pub b: ArrValue,203	split: usize,204	len: usize,205}206impl ExtendedArray {207	pub fn new(a: ArrValue, b: ArrValue) -> Self {208		let a_len = a.len();209		let b_len = b.len();210		Self {211			a,212			b,213			split: a_len,214			len: a_len.checked_add(b_len).expect("too large array value"),215		}216	}217}218219struct WithExactSize<I>(I, usize);220impl<I, T> Iterator for WithExactSize<I>221where222	I: Iterator<Item = T>,223{224	type Item = T;225226	fn next(&mut self) -> Option<Self::Item> {227		self.0.next()228	}229	fn nth(&mut self, n: usize) -> Option<Self::Item> {230		self.0.nth(n)231	}232	fn size_hint(&self) -> (usize, Option<usize>) {233		(self.1, Some(self.1))234	}235}236impl<I> DoubleEndedIterator for WithExactSize<I>237where238	I: DoubleEndedIterator,239{240	fn next_back(&mut self) -> Option<Self::Item> {241		self.0.next_back()242	}243	fn nth_back(&mut self, n: usize) -> Option<Self::Item> {244		self.0.nth_back(n)245	}246}247impl<I> ExactSizeIterator for WithExactSize<I>248where249	I: Iterator,250{251	fn len(&self) -> usize {252		self.1253	}254}255impl ArrayLike for ExtendedArray {256	fn get(&self, index: usize) -> Result<Option<Val>> {257		if self.split > index {258			self.a.get(index)259		} else {260			self.b.get(index - self.split)261		}262	}263	fn get_lazy(&self, index: usize) -> Option<Thunk<Val>> {264		if self.split > index {265			self.a.get_lazy(index)266		} else {267			self.b.get_lazy(index - self.split)268		}269	}270271	fn len(&self) -> usize {272		self.len273	}274275	fn get_cheap(&self, index: usize) -> Option<Val> {276		if self.split > index {277			self.a.get_cheap(index)278		} else {279			self.b.get_cheap(index - self.split)280		}281	}282	fn is_cheap(&self) -> bool {283		self.a.is_cheap() && self.b.is_cheap()284	}285}286287#[derive(Trace, Debug)]288pub struct LazyArray(pub Vec<Thunk<Val>>);289impl ArrayLike for LazyArray {290	fn len(&self) -> usize {291		self.0.len()292	}293	fn get(&self, index: usize) -> Result<Option<Val>> {294		let Some(v) = self.0.get(index) else {295			return Ok(None);296		};297		v.evaluate().map(Some)298	}299	fn get_cheap(&self, _index: usize) -> Option<Val> {300		None301	}302	fn get_lazy(&self, index: usize) -> Option<Thunk<Val>> {303		self.0.get(index).cloned()304	}305	fn is_cheap(&self) -> bool {306		false307	}308}309310#[derive(Trace, Debug)]311pub struct EagerArray(pub Vec<Val>);312impl ArrayLike for EagerArray {313	fn len(&self) -> usize {314		self.0.len()315	}316317	fn get(&self, index: usize) -> Result<Option<Val>> {318		Ok(self.0.get(index).cloned())319	}320321	fn get_lazy(&self, index: usize) -> Option<Thunk<Val>> {322		self.0.get(index).cloned().map(Thunk::evaluated)323	}324325	fn get_cheap(&self, index: usize) -> Option<Val> {326		self.0.get(index).cloned()327	}328	fn is_cheap(&self) -> bool {329		true330	}331}332333/// Inclusive range type334#[derive(Debug, Trace, PartialEq, Eq)]335pub struct RangeArray {336	start: i32,337	end: i32,338}339impl RangeArray {340	pub fn empty() -> Self {341		Self::new_exclusive(0, 0)342	}343	pub fn new_exclusive(start: i32, end: i32) -> Self {344		end.checked_sub(1)345			.map_or_else(Self::empty, |end| Self { start, end })346	}347	pub fn new_inclusive(start: i32, end: i32) -> Self {348		Self { start, end }349	}350	fn range(&self) -> impl ExactSizeIterator<Item = i32> + DoubleEndedIterator {351		WithExactSize(352			self.start..=self.end,353			(self.end as usize)354				.wrapping_sub(self.start as usize)355				.wrapping_add(1),356		)357	}358}359360impl ArrayLike for RangeArray {361	fn len(&self) -> usize {362		self.range().len()363	}364	fn is_empty(&self) -> bool {365		self.range().len() == 0366	}367368	fn get(&self, index: usize) -> Result<Option<Val>> {369		Ok(self.get_cheap(index))370	}371372	fn get_lazy(&self, index: usize) -> Option<Thunk<Val>> {373		self.get_cheap(index).map(Thunk::evaluated)374	}375376	fn get_cheap(&self, index: usize) -> Option<Val> {377		self.range().nth(index).map(|i| Val::Num(i.into()))378	}379	fn is_cheap(&self) -> bool {380		true381	}382}383384#[derive(Debug, Trace)]385pub struct ReverseArray(pub ArrValue);386impl ArrayLike for ReverseArray {387	fn len(&self) -> usize {388		self.0.len()389	}390391	fn get(&self, index: usize) -> Result<Option<Val>> {392		self.0.get(self.0.len() - index - 1)393	}394395	fn get_lazy(&self, index: usize) -> Option<Thunk<Val>> {396		self.0.get_lazy(self.0.len() - index - 1)397	}398399	fn get_cheap(&self, index: usize) -> Option<Val> {400		self.0.get_cheap(self.0.len() - index - 1)401	}402	fn is_cheap(&self) -> bool {403		self.0.is_cheap()404	}405}406407#[derive(Trace, Debug, Clone)]408pub struct MappedArray<const WITH_INDEX: bool> {409	inner: ArrValue,410	cached: Cc<RefCell<Vec<ArrayThunk>>>,411	mapper: FuncVal,412}413impl<const WITH_INDEX: bool> MappedArray<WITH_INDEX> {414	pub fn new(inner: ArrValue, mapper: FuncVal) -> Self {415		let len = inner.len();416		Self {417			inner,418			cached: Cc::new(RefCell::new(vec![ArrayThunk::Waiting; len])),419			mapper,420		}421	}422	fn evaluate(&self, index: usize, value: Val) -> Result<Val> {423		if WITH_INDEX {424			self.mapper.evaluate_simple(&(index, value), false)425		} else {426			self.mapper.evaluate_simple(&(value,), false)427		}428	}429}430impl<const WITH_INDEX: bool> ArrayLike for MappedArray<WITH_INDEX> {431	fn len(&self) -> usize {432		self.cached.borrow().len()433	}434435	fn get(&self, index: usize) -> Result<Option<Val>> {436		if index >= self.len() {437			return Ok(None);438		}439		match &self.cached.borrow()[index] {440			ArrayThunk::Computed(c) => return Ok(Some(c.clone())),441			ArrayThunk::Errored(e) => return Err(e.clone()),442			ArrayThunk::Pending => return Err(InfiniteRecursionDetected.into()),443			ArrayThunk::Waiting => {}444		};445446		let ArrayThunk::Waiting =447			replace(&mut self.cached.borrow_mut()[index], ArrayThunk::Pending)448		else {449			unreachable!()450		};451452		let val = self453			.inner454			.get(index)455			.transpose()456			.expect("index checked")457			.and_then(|r| self.evaluate(index, r));458459		let new_value = match val {460			Ok(v) => v,461			Err(e) => {462				self.cached.borrow_mut()[index] = ArrayThunk::Errored(e.clone());463				return Err(e);464			}465		};466		self.cached.borrow_mut()[index] = ArrayThunk::Computed(new_value.clone());467		Ok(Some(new_value))468	}469	fn get_lazy(&self, index: usize) -> Option<Thunk<Val>> {470		if index >= self.len() {471			return None;472		}473		match &self.cached.borrow()[index] {474			ArrayThunk::Computed(c) => return Some(Thunk::evaluated(c.clone())),475			ArrayThunk::Errored(e) => return Some(Thunk::errored(e.clone())),476			ArrayThunk::Waiting | ArrayThunk::Pending => {}477		};478479		#[derive(Trace)]480		struct MappedArrayThunk<const WITH_INDEX: bool> {481			arr: MappedArray<WITH_INDEX>,482			index: usize,483		}484		impl<const WITH_INDEX: bool> ThunkValue for MappedArrayThunk<WITH_INDEX> {485			type Output = Val;486487			fn get(&self) -> Result<Self::Output> {488				self.arr.get(self.index).transpose().expect("index checked")489			}490		}491492		Some(Thunk::new(MappedArrayThunk {493			arr: self.clone(),494			index,495		}))496	}497498	fn get_cheap(&self, _index: usize) -> Option<Val> {499		None500	}501	fn is_cheap(&self) -> bool {502		false503	}504}505506#[derive(Trace, Debug)]507pub struct RepeatedArray {508	data: ArrValue,509	repeats: usize,510	total_len: usize,511}512impl RepeatedArray {513	pub fn new(data: ArrValue, repeats: usize) -> Option<Self> {514		let total_len = data.len().checked_mul(repeats)?;515		Some(Self {516			data,517			repeats,518			total_len,519		})520	}521}522523impl ArrayLike for RepeatedArray {524	fn len(&self) -> usize {525		self.total_len526	}527528	fn get(&self, index: usize) -> Result<Option<Val>> {529		if index > self.total_len {530			return Ok(None);531		}532		self.data.get(index % self.data.len())533	}534535	fn get_lazy(&self, index: usize) -> Option<Thunk<Val>> {536		if index > self.total_len {537			return None;538		}539		self.data.get_lazy(index % self.data.len())540	}541542	fn get_cheap(&self, index: usize) -> Option<Val> {543		if index > self.total_len {544			return None;545		}546		self.data.get_cheap(index % self.data.len())547	}548	fn is_cheap(&self) -> bool {549		self.data.is_cheap()550	}551}552553#[derive(Trace, Debug)]554pub struct PickObjectValues {555	obj: ObjValue,556	keys: Vec<IStr>,557}558559impl PickObjectValues {560	pub fn new(obj: ObjValue, keys: Vec<IStr>) -> Self {561		Self { obj, keys }562	}563}564565impl ArrayLike for PickObjectValues {566	fn len(&self) -> usize {567		self.keys.len()568	}569570	fn get(&self, index: usize) -> Result<Option<Val>> {571		let Some(key) = self.keys.get(index) else {572			return Ok(None);573		};574		Ok(Some(self.obj.get_or_bail(key.clone())?))575	}576577	fn get_lazy(&self, index: usize) -> Option<Thunk<Val>> {578		let key = self.keys.get(index)?;579		Some(self.obj.get_lazy_or_bail(key.clone()))580	}581582	fn get_cheap(&self, _index: usize) -> Option<Val> {583		None584	}585586	fn is_cheap(&self) -> bool {587		false588	}589}590591#[derive(Trace, Debug)]592pub struct PickObjectKeyValues {593	obj: ObjValue,594	keys: Vec<IStr>,595}596597impl PickObjectKeyValues {598	pub fn new(obj: ObjValue, keys: Vec<IStr>) -> Self {599		Self { obj, keys }600	}601}602603#[derive(Typed)]604pub struct KeyValue {605	key: IStr,606	value: Thunk<Val>,607}608609impl ArrayLike for PickObjectKeyValues {610	fn len(&self) -> usize {611		self.keys.len()612	}613614	fn get(&self, index: usize) -> Result<Option<Val>> {615		let Some(key) = self.keys.get(index) else {616			return Ok(None);617		};618		Ok(Some(619			KeyValue::into_untyped(KeyValue {620				key: key.clone(),621				value: Thunk::evaluated(self.obj.get_or_bail(key.clone())?),622			})623			.expect("convertible"),624		))625	}626627	fn get_lazy(&self, index: usize) -> Option<Thunk<Val>> {628		let key = self.keys.get(index)?;629		// Nothing can fail in the key part, yet value is still630		// lazy-evaluated631		Some(Thunk::evaluated(632			KeyValue::into_untyped(KeyValue {633				key: key.clone(),634				value: self.obj.get_lazy_or_bail(key.clone()),635			})636			.expect("convertible"),637		))638	}639640	fn get_cheap(&self, _index: usize) -> Option<Val> {641		None642	}643644	fn is_cheap(&self) -> bool {645		false646	}647}
after · crates/jrsonnet-evaluator/src/arr/spec.rs
1use std::rc::Rc;2use std::{any::Any, cell::RefCell, fmt::Debug, mem::replace};34use jrsonnet_gcmodule::{Cc, Trace};5use jrsonnet_interner::{IBytes, IStr};6use jrsonnet_parser::{Expr, Spanned};78use super::ArrValue;9use crate::{10	error::ErrorKind::InfiniteRecursionDetected, evaluate, function::FuncVal, typed::Typed,11	val::ThunkValue, Context, Error, ObjValue, Result, Thunk, Val,12};1314pub trait ArrayLike: Any + Trace + Debug {15	fn len(&self) -> usize;16	fn is_empty(&self) -> bool {17		self.len() == 018	}19	fn get(&self, index: usize) -> Result<Option<Val>>;20	fn get_lazy(&self, index: usize) -> Option<Thunk<Val>>;21	fn get_cheap(&self, index: usize) -> Option<Val>;2223	fn is_cheap(&self) -> bool;24}2526#[derive(Debug, Trace)]27pub struct SliceArray {28	pub(crate) inner: ArrValue,29	pub(crate) from: u32,30	pub(crate) to: u32,31	pub(crate) step: u32,32}3334impl SliceArray {35	fn map_idx(&self, index: usize) -> usize {36		self.from as usize + self.step as usize * index37	}38}39impl ArrayLike for SliceArray {40	fn len(&self) -> usize {41		(self.to - self.from).div_ceil(self.step) as usize42	}4344	fn get(&self, index: usize) -> Result<Option<Val>> {45		self.inner.get(self.map_idx(index))46	}4748	fn get_lazy(&self, index: usize) -> Option<Thunk<Val>> {49		self.inner.get_lazy(self.map_idx(index))50	}5152	fn get_cheap(&self, index: usize) -> Option<Val> {53		self.inner.get_cheap(self.map_idx(index))54	}55	fn is_cheap(&self) -> bool {56		self.inner.is_cheap()57	}58}5960#[derive(Trace, Debug)]61pub struct CharArray(pub Vec<char>);62impl ArrayLike for CharArray {63	fn len(&self) -> usize {64		self.0.len()65	}6667	fn get(&self, index: usize) -> Result<Option<Val>> {68		Ok(self.get_cheap(index))69	}7071	fn get_lazy(&self, index: usize) -> Option<Thunk<Val>> {72		self.get_cheap(index).map(Thunk::evaluated)73	}7475	fn get_cheap(&self, index: usize) -> Option<Val> {76		self.0.get(index).map(|v| Val::string(*v))77	}78	fn is_cheap(&self) -> bool {79		true80	}81}8283#[derive(Trace, Debug)]84pub struct BytesArray(pub IBytes);85impl ArrayLike for BytesArray {86	fn len(&self) -> usize {87		self.0.len()88	}8990	fn get(&self, index: usize) -> Result<Option<Val>> {91		Ok(self.get_cheap(index))92	}9394	fn get_lazy(&self, index: usize) -> Option<Thunk<Val>> {95		self.get_cheap(index).map(Thunk::evaluated)96	}9798	fn get_cheap(&self, index: usize) -> Option<Val> {99		self.0.get(index).map(|v| Val::Num((*v).into()))100	}101	fn is_cheap(&self) -> bool {102		true103	}104}105106#[derive(Debug, Trace, Clone)]107enum ArrayThunk {108	Computed(Val),109	Errored(Error),110	Waiting,111	Pending,112}113114#[derive(Debug, Trace, Clone)]115pub struct ExprArray {116	ctx: Context,117	src: Rc<Vec<Spanned<Expr>>>,118	cached: Cc<RefCell<Vec<ArrayThunk>>>,119}120impl ExprArray {121	pub fn new(ctx: Context, src: Rc<Vec<Spanned<Expr>>>) -> Self {122		Self {123			ctx,124			cached: Cc::new(RefCell::new(vec![ArrayThunk::Waiting; src.len()])),125			src,126		}127	}128}129impl ArrayLike for ExprArray {130	fn len(&self) -> usize {131		self.cached.borrow().len()132	}133	fn get(&self, index: usize) -> Result<Option<Val>> {134		if index >= self.len() {135			return Ok(None);136		}137		match &self.cached.borrow()[index] {138			ArrayThunk::Computed(c) => return Ok(Some(c.clone())),139			ArrayThunk::Errored(e) => return Err(e.clone()),140			ArrayThunk::Pending => return Err(InfiniteRecursionDetected.into()),141			ArrayThunk::Waiting => {}142		}143144		let ArrayThunk::Waiting =145			replace(&mut self.cached.borrow_mut()[index], ArrayThunk::Pending)146		else {147			unreachable!()148		};149150		let new_value = match evaluate(self.ctx.clone(), &self.src[index]) {151			Ok(v) => v,152			Err(e) => {153				self.cached.borrow_mut()[index] = ArrayThunk::Errored(e.clone());154				return Err(e);155			}156		};157		self.cached.borrow_mut()[index] = ArrayThunk::Computed(new_value.clone());158		Ok(Some(new_value))159	}160	fn get_lazy(&self, index: usize) -> Option<Thunk<Val>> {161		#[derive(Trace)]162		struct ExprArrThunk {163			expr: ExprArray,164			index: usize,165		}166		impl ThunkValue for ExprArrThunk {167			type Output = Val;168169			fn get(&self) -> Result<Self::Output> {170				self.expr171					.get(self.index)172					.transpose()173					.expect("index checked")174			}175		}176177		if index >= self.len() {178			return None;179		}180		match &self.cached.borrow()[index] {181			ArrayThunk::Computed(c) => return Some(Thunk::evaluated(c.clone())),182			ArrayThunk::Errored(e) => return Some(Thunk::errored(e.clone())),183			ArrayThunk::Waiting | ArrayThunk::Pending => {}184		}185186		Some(Thunk::new(ExprArrThunk {187			expr: self.clone(),188			index,189		}))190	}191	fn get_cheap(&self, _index: usize) -> Option<Val> {192		None193	}194	fn is_cheap(&self) -> bool {195		false196	}197}198199#[derive(Trace, Debug)]200pub struct ExtendedArray {201	pub a: ArrValue,202	pub b: ArrValue,203	split: usize,204	len: usize,205}206impl ExtendedArray {207	pub fn new(a: ArrValue, b: ArrValue) -> Self {208		let a_len = a.len();209		let b_len = b.len();210		Self {211			a,212			b,213			split: a_len,214			len: a_len.checked_add(b_len).expect("too large array value"),215		}216	}217}218219struct WithExactSize<I>(I, usize);220impl<I, T> Iterator for WithExactSize<I>221where222	I: Iterator<Item = T>,223{224	type Item = T;225226	fn next(&mut self) -> Option<Self::Item> {227		self.0.next()228	}229	fn nth(&mut self, n: usize) -> Option<Self::Item> {230		self.0.nth(n)231	}232	fn size_hint(&self) -> (usize, Option<usize>) {233		(self.1, Some(self.1))234	}235}236impl<I> DoubleEndedIterator for WithExactSize<I>237where238	I: DoubleEndedIterator,239{240	fn next_back(&mut self) -> Option<Self::Item> {241		self.0.next_back()242	}243	fn nth_back(&mut self, n: usize) -> Option<Self::Item> {244		self.0.nth_back(n)245	}246}247impl<I> ExactSizeIterator for WithExactSize<I>248where249	I: Iterator,250{251	fn len(&self) -> usize {252		self.1253	}254}255impl ArrayLike for ExtendedArray {256	fn get(&self, index: usize) -> Result<Option<Val>> {257		if self.split > index {258			self.a.get(index)259		} else {260			self.b.get(index - self.split)261		}262	}263	fn get_lazy(&self, index: usize) -> Option<Thunk<Val>> {264		if self.split > index {265			self.a.get_lazy(index)266		} else {267			self.b.get_lazy(index - self.split)268		}269	}270271	fn len(&self) -> usize {272		self.len273	}274275	fn get_cheap(&self, index: usize) -> Option<Val> {276		if self.split > index {277			self.a.get_cheap(index)278		} else {279			self.b.get_cheap(index - self.split)280		}281	}282	fn is_cheap(&self) -> bool {283		self.a.is_cheap() && self.b.is_cheap()284	}285}286287#[derive(Trace, Debug)]288pub struct LazyArray(pub Vec<Thunk<Val>>);289impl ArrayLike for LazyArray {290	fn len(&self) -> usize {291		self.0.len()292	}293	fn get(&self, index: usize) -> Result<Option<Val>> {294		let Some(v) = self.0.get(index) else {295			return Ok(None);296		};297		v.evaluate().map(Some)298	}299	fn get_cheap(&self, _index: usize) -> Option<Val> {300		None301	}302	fn get_lazy(&self, index: usize) -> Option<Thunk<Val>> {303		self.0.get(index).cloned()304	}305	fn is_cheap(&self) -> bool {306		false307	}308}309310#[derive(Trace, Debug)]311pub struct EagerArray(pub Vec<Val>);312impl ArrayLike for EagerArray {313	fn len(&self) -> usize {314		self.0.len()315	}316317	fn get(&self, index: usize) -> Result<Option<Val>> {318		Ok(self.0.get(index).cloned())319	}320321	fn get_lazy(&self, index: usize) -> Option<Thunk<Val>> {322		self.0.get(index).cloned().map(Thunk::evaluated)323	}324325	fn get_cheap(&self, index: usize) -> Option<Val> {326		self.0.get(index).cloned()327	}328	fn is_cheap(&self) -> bool {329		true330	}331}332333/// Inclusive range type334#[derive(Debug, Trace, PartialEq, Eq)]335pub struct RangeArray {336	start: i32,337	end: i32,338}339impl RangeArray {340	pub fn empty() -> Self {341		Self::new_exclusive(0, 0)342	}343	pub fn new_exclusive(start: i32, end: i32) -> Self {344		end.checked_sub(1)345			.map_or_else(Self::empty, |end| Self { start, end })346	}347	pub fn new_inclusive(start: i32, end: i32) -> Self {348		Self { start, end }349	}350	fn range(&self) -> impl ExactSizeIterator<Item = i32> + DoubleEndedIterator {351		WithExactSize(352			self.start..=self.end,353			(self.end as usize)354				.wrapping_sub(self.start as usize)355				.wrapping_add(1),356		)357	}358}359360impl ArrayLike for RangeArray {361	fn len(&self) -> usize {362		self.range().len()363	}364	fn is_empty(&self) -> bool {365		self.range().len() == 0366	}367368	fn get(&self, index: usize) -> Result<Option<Val>> {369		Ok(self.get_cheap(index))370	}371372	fn get_lazy(&self, index: usize) -> Option<Thunk<Val>> {373		self.get_cheap(index).map(Thunk::evaluated)374	}375376	fn get_cheap(&self, index: usize) -> Option<Val> {377		self.range().nth(index).map(|i| Val::Num(i.into()))378	}379	fn is_cheap(&self) -> bool {380		true381	}382}383384#[derive(Debug, Trace)]385pub struct ReverseArray(pub ArrValue);386impl ArrayLike for ReverseArray {387	fn len(&self) -> usize {388		self.0.len()389	}390391	fn get(&self, index: usize) -> Result<Option<Val>> {392		self.0.get(self.0.len() - index - 1)393	}394395	fn get_lazy(&self, index: usize) -> Option<Thunk<Val>> {396		self.0.get_lazy(self.0.len() - index - 1)397	}398399	fn get_cheap(&self, index: usize) -> Option<Val> {400		self.0.get_cheap(self.0.len() - index - 1)401	}402	fn is_cheap(&self) -> bool {403		self.0.is_cheap()404	}405}406407#[derive(Trace, Debug, Clone)]408pub struct MappedArray<const WITH_INDEX: bool> {409	inner: ArrValue,410	cached: Cc<RefCell<Vec<ArrayThunk>>>,411	mapper: FuncVal,412}413impl<const WITH_INDEX: bool> MappedArray<WITH_INDEX> {414	pub fn new(inner: ArrValue, mapper: FuncVal) -> Self {415		let len = inner.len();416		Self {417			inner,418			cached: Cc::new(RefCell::new(vec![ArrayThunk::Waiting; len])),419			mapper,420		}421	}422	fn evaluate(&self, index: usize, value: Val) -> Result<Val> {423		if WITH_INDEX {424			self.mapper.evaluate_simple(&(index, value), false)425		} else {426			self.mapper.evaluate_simple(&(value,), false)427		}428	}429}430impl<const WITH_INDEX: bool> ArrayLike for MappedArray<WITH_INDEX> {431	fn len(&self) -> usize {432		self.cached.borrow().len()433	}434435	fn get(&self, index: usize) -> Result<Option<Val>> {436		if index >= self.len() {437			return Ok(None);438		}439		match &self.cached.borrow()[index] {440			ArrayThunk::Computed(c) => return Ok(Some(c.clone())),441			ArrayThunk::Errored(e) => return Err(e.clone()),442			ArrayThunk::Pending => return Err(InfiniteRecursionDetected.into()),443			ArrayThunk::Waiting => {}444		}445446		let ArrayThunk::Waiting =447			replace(&mut self.cached.borrow_mut()[index], ArrayThunk::Pending)448		else {449			unreachable!()450		};451452		let val = self453			.inner454			.get(index)455			.transpose()456			.expect("index checked")457			.and_then(|r| self.evaluate(index, r));458459		let new_value = match val {460			Ok(v) => v,461			Err(e) => {462				self.cached.borrow_mut()[index] = ArrayThunk::Errored(e.clone());463				return Err(e);464			}465		};466		self.cached.borrow_mut()[index] = ArrayThunk::Computed(new_value.clone());467		Ok(Some(new_value))468	}469	fn get_lazy(&self, index: usize) -> Option<Thunk<Val>> {470		#[derive(Trace)]471		struct MappedArrayThunk<const WITH_INDEX: bool> {472			arr: MappedArray<WITH_INDEX>,473			index: usize,474		}475		impl<const WITH_INDEX: bool> ThunkValue for MappedArrayThunk<WITH_INDEX> {476			type Output = Val;477478			fn get(&self) -> Result<Self::Output> {479				self.arr.get(self.index).transpose().expect("index checked")480			}481		}482483		if index >= self.len() {484			return None;485		}486		match &self.cached.borrow()[index] {487			ArrayThunk::Computed(c) => return Some(Thunk::evaluated(c.clone())),488			ArrayThunk::Errored(e) => return Some(Thunk::errored(e.clone())),489			ArrayThunk::Waiting | ArrayThunk::Pending => {}490		}491492		Some(Thunk::new(MappedArrayThunk {493			arr: self.clone(),494			index,495		}))496	}497498	fn get_cheap(&self, _index: usize) -> Option<Val> {499		None500	}501	fn is_cheap(&self) -> bool {502		false503	}504}505506#[derive(Trace, Debug)]507pub struct RepeatedArray {508	data: ArrValue,509	repeats: usize,510	total_len: usize,511}512impl RepeatedArray {513	pub fn new(data: ArrValue, repeats: usize) -> Option<Self> {514		let total_len = data.len().checked_mul(repeats)?;515		Some(Self {516			data,517			repeats,518			total_len,519		})520	}521}522523impl ArrayLike for RepeatedArray {524	fn len(&self) -> usize {525		self.total_len526	}527528	fn get(&self, index: usize) -> Result<Option<Val>> {529		if index > self.total_len {530			return Ok(None);531		}532		self.data.get(index % self.data.len())533	}534535	fn get_lazy(&self, index: usize) -> Option<Thunk<Val>> {536		if index > self.total_len {537			return None;538		}539		self.data.get_lazy(index % self.data.len())540	}541542	fn get_cheap(&self, index: usize) -> Option<Val> {543		if index > self.total_len {544			return None;545		}546		self.data.get_cheap(index % self.data.len())547	}548	fn is_cheap(&self) -> bool {549		self.data.is_cheap()550	}551}552553#[derive(Trace, Debug)]554pub struct PickObjectValues {555	obj: ObjValue,556	keys: Vec<IStr>,557}558559impl PickObjectValues {560	pub fn new(obj: ObjValue, keys: Vec<IStr>) -> Self {561		Self { obj, keys }562	}563}564565impl ArrayLike for PickObjectValues {566	fn len(&self) -> usize {567		self.keys.len()568	}569570	fn get(&self, index: usize) -> Result<Option<Val>> {571		let Some(key) = self.keys.get(index) else {572			return Ok(None);573		};574		Ok(Some(self.obj.get_or_bail(key.clone())?))575	}576577	fn get_lazy(&self, index: usize) -> Option<Thunk<Val>> {578		let key = self.keys.get(index)?;579		Some(self.obj.get_lazy_or_bail(key.clone()))580	}581582	fn get_cheap(&self, _index: usize) -> Option<Val> {583		None584	}585586	fn is_cheap(&self) -> bool {587		false588	}589}590591#[derive(Trace, Debug)]592pub struct PickObjectKeyValues {593	obj: ObjValue,594	keys: Vec<IStr>,595}596597impl PickObjectKeyValues {598	pub fn new(obj: ObjValue, keys: Vec<IStr>) -> Self {599		Self { obj, keys }600	}601}602603#[derive(Typed)]604pub struct KeyValue {605	key: IStr,606	value: Thunk<Val>,607}608609impl ArrayLike for PickObjectKeyValues {610	fn len(&self) -> usize {611		self.keys.len()612	}613614	fn get(&self, index: usize) -> Result<Option<Val>> {615		let Some(key) = self.keys.get(index) else {616			return Ok(None);617		};618		Ok(Some(619			KeyValue::into_untyped(KeyValue {620				key: key.clone(),621				value: Thunk::evaluated(self.obj.get_or_bail(key.clone())?),622			})623			.expect("convertible"),624		))625	}626627	fn get_lazy(&self, index: usize) -> Option<Thunk<Val>> {628		let key = self.keys.get(index)?;629		// Nothing can fail in the key part, yet value is still630		// lazy-evaluated631		Some(Thunk::evaluated(632			KeyValue::into_untyped(KeyValue {633				key: key.clone(),634				value: self.obj.get_lazy_or_bail(key.clone()),635			})636			.expect("convertible"),637		))638	}639640	fn get_cheap(&self, _index: usize) -> Option<Val> {641		None642	}643644	fn is_cheap(&self) -> bool {645		false646	}647}
modifiedcrates/jrsonnet-evaluator/src/async_import.rsdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/async_import.rs
+++ b/crates/jrsonnet-evaluator/src/async_import.rs
@@ -21,7 +21,8 @@
 // Visits all nodes, trying to find import statements
 #[allow(clippy::too_many_lines)]
 pub fn find_imports(expr: &Spanned<Expr>, out: &mut FoundImports) {
-	fn in_destruct(dest: &Destruct, #[allow(unused_variables)] out: &mut FoundImports) {
+	#[allow(unused_variables, clippy::needless_pass_by_ref_mut)]
+	fn in_destruct(dest: &Destruct, out: &mut FoundImports) {
 		match dest {
 			#[cfg(feature = "exp-destruct")]
 			Destruct::Array {
@@ -295,8 +296,6 @@
 	let resolved = (s.import_resolver() as &dyn Any)
 		.downcast_ref::<ResolvedImportResolver>()
 		.expect("for async imports, import_resolver should be set to ResolvedImportResolver");
-
-	let mut resolved_map = resolved.resolved.borrow_mut();
 
 	let mut queue = vec![Job::LoadFile {
 		path: handler.resolve_from_default(path).await?,
@@ -340,14 +339,17 @@
 				}
 			}
 			Job::ResolveImport { from, import } => {
-				if let Some((resolved, expression)) =
-					resolved_map.get_mut(&(from.clone(), import.path.clone()))
 				{
-					if import.expression && !*expression {
-						*expression = true;
-						queue.push(Job::ParseFile(resolved.clone()));
+					let mut resolved_map = resolved.resolved.borrow_mut();
+					if let Some((resolved, expression)) =
+						resolved_map.get_mut(&(from.clone(), import.path.clone()))
+					{
+						if import.expression && !*expression {
+							*expression = true;
+							queue.push(Job::ParseFile(resolved.clone()));
+						}
+						continue;
 					}
-					continue;
 				}
 				let resolved = handler.resolve_from(&from, &import.path).await?;
 				queue.push(Job::LoadFile {
modifiedcrates/jrsonnet-evaluator/src/evaluate/destructure.rsdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/evaluate/destructure.rs
+++ b/crates/jrsonnet-evaluator/src/evaluate/destructure.rs
@@ -1,6 +1,7 @@
+use std::{collections::HashMap, hash::BuildHasher};
+
 use jrsonnet_interner::IStr;
 use jrsonnet_parser::{BindSpec, Destruct};
-use rustc_hash::FxHashMap;
 
 use crate::{
 	bail,
@@ -10,11 +11,11 @@
 
 #[allow(clippy::too_many_lines)]
 #[allow(unused_variables)]
-pub fn destruct(
+pub fn destruct<H: BuildHasher>(
 	d: &Destruct,
 	parent: Thunk<Val>,
 	fctx: Pending<Context>,
-	new_bindings: &mut FxHashMap<IStr, Thunk<Val>>,
+	new_bindings: &mut HashMap<IStr, Thunk<Val>, H>,
 ) -> Result<()> {
 	match d {
 		Destruct::Full(v) => {
@@ -159,10 +160,10 @@
 	Ok(())
 }
 
-pub fn evaluate_dest(
+pub fn evaluate_dest<H: BuildHasher>(
 	d: &BindSpec,
 	fctx: Pending<Context>,
-	new_bindings: &mut FxHashMap<IStr, Thunk<Val>>,
+	new_bindings: &mut HashMap<IStr, Thunk<Val>, H>,
 ) -> Result<()> {
 	match d {
 		BindSpec::Field { into, value } => {
modifiedcrates/jrsonnet-evaluator/src/evaluate/mod.rsdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/evaluate/mod.rs
+++ b/crates/jrsonnet-evaluator/src/evaluate/mod.rs
@@ -291,7 +291,7 @@
 	let uctx = CachedUnbound::new(evaluate_object_locals(ctx.clone(), locals));
 
 	for field in &members.fields {
-		evaluate_field_member(&mut builder, ctx.clone(), uctx.clone(), &field)?;
+		evaluate_field_member(&mut builder, ctx.clone(), uctx.clone(), field)?;
 	}
 
 	if !members.asserts.is_empty() {
@@ -304,13 +304,13 @@
 			fn run(&self, sup_this: SupThis) -> Result<()> {
 				let ctx = self.uctx.bind(sup_this)?;
 				for assert in &*self.asserts {
-					evaluate_assert(ctx.clone(), &assert)?;
+					evaluate_assert(ctx.clone(), assert)?;
 				}
 				Ok(())
 			}
 		}
 		builder.assert(ObjectAssert {
-			uctx: uctx.clone(),
+			uctx,
 			asserts: members.asserts.clone(),
 		});
 	}
@@ -567,7 +567,7 @@
 				evaluate_dest(b, fctx.clone(), &mut new_bindings)?;
 			}
 			let ctx = ctx.extend_bindings(new_bindings).into_future(fctx);
-			evaluate(ctx, &returned.clone())?
+			evaluate(ctx, returned)?
 		}
 		Arr(items) => {
 			if items.is_empty() {
modifiedcrates/jrsonnet-evaluator/src/evaluate/operator.rsdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/evaluate/operator.rs
+++ b/crates/jrsonnet-evaluator/src/evaluate/operator.rs
@@ -95,9 +95,9 @@
 		// string format
 		(Str(_), _) => false,
 
-		(_, Num(b)) => return **b == 0.,
+		(_, Num(b)) => **b == 0.,
 		#[cfg(feature = "exp-bigint")]
-		(_, BigInt(b)) => return **b == num_bigint::BigInt::ZERO,
+		(_, BigInt(b)) => **b == num_bigint::BigInt::ZERO,
 
 		// something else
 		_ => false,
modifiedcrates/jrsonnet-evaluator/src/function/arglike.rsdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/function/arglike.rs
+++ b/crates/jrsonnet-evaluator/src/function/arglike.rs
@@ -239,7 +239,7 @@
 	}
 
 	fn named_names(&self, handler: &mut dyn FnMut(&IStr)) {
-		for (name, _) in self {
+		for name in self.keys() {
 			handler(name);
 		}
 	}
modifiedcrates/jrsonnet-evaluator/src/function/parse.rsdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/function/parse.rs
+++ b/crates/jrsonnet-evaluator/src/function/parse.rs
@@ -1,5 +1,3 @@
-use std::mem::replace;
-
 use jrsonnet_parser::{
 	function::{FunctionSignature, ParamName},
 	ExprParams,
@@ -87,7 +85,7 @@
 			}
 
 			destruct(
-				&into,
+				into,
 				{
 					let ctx = fctx.clone();
 					let name = into.name();
@@ -97,7 +95,7 @@
 				fctx.clone(),
 				&mut defaults,
 			)?;
-			if !into.name().is_anonymous() {
+			if into.name().is_named() {
 				filled_named += 1;
 			} else {
 				filled_positionals += 1;
@@ -165,7 +163,7 @@
 			.iter()
 			.position(|p| p.name() == name)
 			.ok_or_else(|| UnknownFunctionParameter(name.clone()))?;
-		if replace(&mut passed_args[id], Some(arg)).is_some() {
+		if passed_args[id].replace(arg).is_some() {
 			bail!(BindingParameterASecondTime(name.clone()));
 		}
 		filled_args += 1;
@@ -230,7 +228,7 @@
 					let params = params.clone();
 					Thunk!(move || Err(FunctionParameterNotBoundInCall(
 						param_name,
-						params.signature.clone()
+						params.signature
 					)
 					.into()))
 				},
modifiedcrates/jrsonnet-evaluator/src/gc.rsdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/gc.rs
+++ b/crates/jrsonnet-evaluator/src/gc.rs
@@ -1,3 +1,8 @@
+#![allow(
+	clippy::implicit_hasher,
+	reason = "those methods exist exactly because with_capacity is only present for default BuildHasher"
+)]
+
 /// Macros to help deal with Gc
 use jrsonnet_gcmodule::Trace;
 use rustc_hash::{FxBuildHasher, FxHashMap, FxHashSet};
@@ -8,20 +13,20 @@
 }
 impl<V> WithCapacityExt for FxHashSet<V> {
 	fn with_capacity(capacity: usize) -> Self {
-		Self::with_capacity_and_hasher(capacity, FxBuildHasher::default())
+		Self::with_capacity_and_hasher(capacity, FxBuildHasher)
 	}
 
 	fn new() -> Self {
-		Self::with_hasher(FxBuildHasher::default())
+		Self::with_hasher(FxBuildHasher)
 	}
 }
 impl<K, V> WithCapacityExt for FxHashMap<K, V> {
 	fn with_capacity(capacity: usize) -> Self {
-		Self::with_capacity_and_hasher(capacity, FxBuildHasher::default())
+		Self::with_capacity_and_hasher(capacity, FxBuildHasher)
 	}
 
 	fn new() -> Self {
-		Self::with_hasher(FxBuildHasher::default())
+		Self::with_hasher(FxBuildHasher)
 	}
 }
 
modifiedcrates/jrsonnet-evaluator/src/lib.rsdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/lib.rs
+++ b/crates/jrsonnet-evaluator/src/lib.rs
@@ -367,7 +367,7 @@
 		let res = evaluate(self.create_default_context(file_name), &parsed);
 
 		let mut file_cache = self.file_cache();
-		let mut file = file_cache.entry(path.clone());
+		let mut file = file_cache.entry(path);
 
 		let Entry::Occupied(file) = &mut file else {
 			unreachable!("this file was just here")
modifiedcrates/jrsonnet-evaluator/src/manifest.rsdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/manifest.rs
+++ b/crates/jrsonnet-evaluator/src/manifest.rs
@@ -240,7 +240,7 @@
 					}
 					ToString if i != 0 => buf.push(' '),
 					Minify | ToString => {}
-				};
+				}
 
 				in_description_frame(
 					|| format!("elem <{i}> manifestification"),
@@ -335,7 +335,7 @@
 			buf.push('}');
 		}
 		Val::Func(_) => bail!("tried to manifest function"),
-	};
+	}
 	Ok(())
 }
 
modifiedcrates/jrsonnet-evaluator/src/map.rsdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/map.rs
+++ b/crates/jrsonnet-evaluator/src/map.rs
@@ -16,7 +16,7 @@
 
 impl LayeredHashMap {
 	pub fn iter_keys(self, mut handler: impl FnMut(IStr)) {
-		for (k, _) in &self.0.current {
+		for k in self.0.current.keys() {
 			handler(k.clone());
 		}
 		if let Some(parent) = self.0.parent.clone() {
@@ -47,11 +47,7 @@
 
 	pub fn contains_key(&self, key: &IStr) -> bool {
 		(self.0).current.contains_key(key)
-			|| self
-				.0
-				.parent
-				.as_ref()
-				.map_or(false, |p| p.contains_key(key))
+			|| self.0.parent.as_ref().is_some_and(|p| p.contains_key(key))
 	}
 }
 
modifiedcrates/jrsonnet-evaluator/src/obj/mod.rsdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/obj/mod.rs
+++ b/crates/jrsonnet-evaluator/src/obj/mod.rs
@@ -1,6 +1,7 @@
 use std::{
 	any::Any,
 	cell::{Cell, RefCell},
+	clone::Clone,
 	collections::hash_map::Entry,
 	fmt::{self, Debug},
 	hash::{Hash, Hasher},
@@ -272,7 +273,7 @@
 
 impl ObjValue {
 	pub fn empty() -> Self {
-		EMPTY_OBJ.with(|v| v.clone())
+		EMPTY_OBJ.with(Clone::clone)
 	}
 	pub fn is_empty(&self) -> bool {
 		self.0.cores.is_empty() || self.len() == 0
@@ -306,14 +307,13 @@
 			return Ok(GetFor::NotFound);
 		}
 		let v = self.this.get_idx(key, self.sup)?;
-		Ok(v.map_or(GetFor::NotFound, |v| GetFor::Final(v)))
+		Ok(v.map_or(GetFor::NotFound, GetFor::Final))
 	}
 
 	fn field_visibility_core(&self, field: IStr) -> FieldVisibility {
-		match self.this.field_visibility_idx(field, self.sup) {
-			Some(c) => FieldVisibility::Found(c),
-			None => FieldVisibility::NotFound,
-		}
+		self.this
+			.field_visibility_idx(field, self.sup)
+			.map_or(FieldVisibility::NotFound, FieldVisibility::Found)
 	}
 
 	fn run_assertions_core(&self, _sup_this: SupThis) -> Result<()> {
modifiedcrates/jrsonnet-evaluator/src/obj/oop.rsdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/obj/oop.rs
+++ b/crates/jrsonnet-evaluator/src/obj/oop.rs
@@ -1,4 +1,4 @@
-use std::cell::Cell;
+use std::cell::{Cell, RefCell};
 use std::ops::ControlFlow;
 use std::{fmt, mem};
 
@@ -105,7 +105,7 @@
 
 	fn run_assertions_core(&self, sup_this: SupThis) -> Result<()> {
 		if let Some(assertion) = &self.assertion {
-			assertion.0.run(sup_this.clone())?;
+			assertion.0.run(sup_this)?;
 		}
 		Ok(())
 	}
@@ -196,7 +196,7 @@
 		ObjValue(Cc::new(ObjValueInner {
 			cores: self.sup,
 			assertions_ran: Cell::new(false),
-			value_cache: Default::default(),
+			value_cache: RefCell::default(),
 		}))
 	}
 }
modifiedcrates/jrsonnet-evaluator/src/stack.rsdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/stack.rs
+++ b/crates/jrsonnet-evaluator/src/stack.rs
@@ -17,6 +17,7 @@
 	}
 }
 #[cfg(not(nightly))]
+#[allow(dead_code)]
 type NightlyLocalKey<T> = std::thread::LocalKey<T>;
 
 #[cfg(nightly)]
@@ -60,7 +61,7 @@
 pub struct StackDepthGuard(PhantomData<()>);
 impl Drop for StackDepthGuard {
 	fn drop(&mut self) {
-		STACK_LIMIT.with(|limit| limit.current_depth.set(limit.current_depth.get() - 1))
+		STACK_LIMIT.with(|limit| limit.current_depth.set(limit.current_depth.get() - 1));
 	}
 }
 
modifiedcrates/jrsonnet-evaluator/src/stdlib/format.rsdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/stdlib/format.rs
+++ b/crates/jrsonnet-evaluator/src/stdlib/format.rs
@@ -297,6 +297,7 @@
 const NUMBERS: &[u8] = b"0123456789abcdefghijklmnopqrstuvwxyz";
 
 #[inline]
+#[allow(clippy::fn_params_excessive_bools)]
 pub fn render_integer(
 	out: &mut String,
 	neg: bool,
@@ -330,7 +331,7 @@
 
 	let pref_len = zero_prefix.len() as u16;
 	let zp2 = zp
-		.saturating_sub(if !prefix_in_padding { pref_len } else { 0 })
+		.saturating_sub(if prefix_in_padding { 0 } else { pref_len })
 		.max(precision)
 		.saturating_sub(if prefix_in_padding { pref_len } else { 0 } + digits.len() as u16);
 
@@ -369,6 +370,7 @@
 		out, neg, iv, padding, precision, blank, sign, 10, "", false, false,
 	);
 }
+#[allow(clippy::fn_params_excessive_bools)]
 pub fn render_octal(
 	out: &mut String,
 	neg: bool,
@@ -439,8 +441,8 @@
 	// Note that it can also be equal to 10**prec and we'll need to carry
 	// over to the wholes.  We operate on the absolute numbers, so that we
 	// don't have trouble with the rounding direction.
-	let denominator = 10.0f64.powi(precision as i32);
-	let numerator = n.abs() * denominator + 0.5;
+	let denominator = 10.0f64.powi(i32::from(precision));
+	let numerator = n.abs().mul_add(denominator, 0.5);
 	let whole = (numerator / denominator).floor();
 	let frac = numerator.floor() % denominator;
 
@@ -611,7 +613,7 @@
 			} else {
 				value.abs().log10().floor()
 			};
-			if exponent < -4.0 || exponent >= fpprec as f64 {
+			if exponent < -4.0 || exponent >= f64::from(fpprec) {
 				render_float_sci(
 					&mut tmp_out,
 					value,
@@ -661,7 +663,7 @@
 			}
 		},
 		ConvTypeV::Percent => tmp_out.push('%'),
-	};
+	}
 
 	let padding = width.saturating_sub(tmp_out.len() as u16);
 
modifiedcrates/jrsonnet-evaluator/src/tla.rsdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/tla.rs
+++ b/crates/jrsonnet-evaluator/src/tla.rs
@@ -1,13 +1,14 @@
+use std::{collections::HashMap, hash::BuildHasher};
+
 use jrsonnet_interner::IStr;
 use jrsonnet_parser::Source;
-use rustc_hash::FxHashMap;
 
 use crate::{
 	function::{CallLocation, TlaArg},
 	in_description_frame, with_state, Result, Val,
 };
 
-pub fn apply_tla(args: &FxHashMap<IStr, TlaArg>, val: Val) -> Result<Val> {
+pub fn apply_tla<H: BuildHasher>(args: &HashMap<IStr, TlaArg, H>, val: Val) -> Result<Val> {
 	Ok(if let Val::Func(func) = val {
 		in_description_frame(
 			|| "during TLA call".to_owned(),
modifiedcrates/jrsonnet-evaluator/src/typed/conversions.rsdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/typed/conversions.rs
+++ b/crates/jrsonnet-evaluator/src/typed/conversions.rs
@@ -462,7 +462,7 @@
 		};
 		if let Some(bytes) = a.as_any().downcast_ref::<BytesArray>() {
 			return Ok(bytes.0.as_slice().into());
-		};
+		}
 		<Self as Typed>::TYPE.check(&value)?;
 		// Any::downcast_ref::<ByteArray>(&a);
 		let mut out = Vec::with_capacity(a.len());
modifiedcrates/jrsonnet-evaluator/src/val.rsdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/val.rs
+++ b/crates/jrsonnet-evaluator/src/val.rs
@@ -65,7 +65,7 @@
 			MemoizedClusureThunkInner::Errored(e) => return Err(e.clone()),
 			MemoizedClusureThunkInner::Pending => return Err(InfiniteRecursionDetected.into()),
 			MemoizedClusureThunkInner::Waiting { .. } => (),
-		};
+		}
 		let MemoizedClusureThunkInner::Waiting { env, closure } = replace(
 			&mut *self.0.borrow_mut(),
 			MemoizedClusureThunkInner::Pending,
@@ -288,14 +288,11 @@
 			Self::Str(s) => {
 				let mut computed_len = None;
 				let mut get_len = || {
-					computed_len.map_or_else(
-						|| {
-							let len = s.chars().count();
-							let _ = computed_len.insert(len);
-							len
-						},
-						|len| len,
-					)
+					computed_len.unwrap_or_else(|| {
+						let len = s.chars().count();
+						let _ = computed_len.insert(len);
+						len
+					})
 				};
 				let mut get_idx = |pos: Option<i32>, default| {
 					match pos {
@@ -446,7 +443,7 @@
 	pub const fn get(&self) -> f64 {
 		self.0
 	}
-	pub(crate) fn truncate_for_bitwise(&self) -> Result<i64> {
+	pub(crate) fn truncate_for_bitwise(self) -> Result<i64> {
 		if self.0 < MIN_SAFE_INTEGER || self.0 > MAX_SAFE_INTEGER {
 			bail!("numberic value outside of safe integer range for bitwise operation");
 		}
modifiedcrates/jrsonnet-interner/src/lib.rsdiffbeforeafterboth
--- a/crates/jrsonnet-interner/src/lib.rs
+++ b/crates/jrsonnet-interner/src/lib.rs
@@ -227,9 +227,11 @@
 type PoolMap = HashMap<Inner, (), FxBuildHasher>;
 
 thread_local! {
-	static POOL: RefCell<PoolMap> = RefCell::new(HashMap::with_capacity_and_hasher(200, FxBuildHasher::default()));
+	static POOL: RefCell<PoolMap> = RefCell::new(HashMap::with_capacity_and_hasher(200, FxBuildHasher));
 }
 
+/// Utils for embedding jrsonnet in non-rust.
+///
 /// Jrsonnet golang bindings require that it is possible to move jsonnet
 /// VM between OS threads, and this is not possible due to usage of
 /// `thread_local`. Instead, there is two methods added, one should be
modifiedcrates/jrsonnet-macros/src/lib.rsdiffbeforeafterboth
--- a/crates/jrsonnet-macros/src/lib.rs
+++ b/crates/jrsonnet-macros/src/lib.rs
@@ -127,6 +127,7 @@
 	Default(Expr),
 }
 
+#[allow(clippy::large_enum_variant, reason = "this macro is not that hot for it to matter")]
 enum ArgInfo {
 	Normal {
 		ty: Box<Type>,
modifiedcrates/jrsonnet-parser/src/expr.rsdiffbeforeafterboth
--- a/crates/jrsonnet-parser/src/expr.rs
+++ b/crates/jrsonnet-parser/src/expr.rs
@@ -166,6 +166,10 @@
 	pub fn len(&self) -> usize {
 		self.exprs.len()
 	}
+	pub fn is_empty(&self) -> bool {
+		self.exprs.is_empty()
+	}
+
 	pub fn binds_len(&self) -> usize {
 		self.binds_len
 	}
modifiedcrates/jrsonnet-stdlib/src/arrays.rsdiffbeforeafterboth
--- a/crates/jrsonnet-stdlib/src/arrays.rs
+++ b/crates/jrsonnet-stdlib/src/arrays.rs
@@ -98,9 +98,9 @@
 			for c in str.chars() {
 				match func(Either2::A(c.to_string()))? {
 					Val::Str(o) => write!(out, "{o}").unwrap(),
-					Val::Null => continue,
+					Val::Null => {},
 					_ => bail!("in std.join all items should be strings"),
-				};
+				}
 			}
 			Ok(IndexableVal::Str(out.into()))
 		}
@@ -114,9 +114,9 @@
 							out.push(oe?);
 						}
 					}
-					Val::Null => continue,
+					Val::Null => {},
 					_ => bail!("in std.join all items should be arrays"),
-				};
+				}
 			}
 			Ok(IndexableVal::Arr(out.into()))
 		}
@@ -205,7 +205,6 @@
 						out.push(item?);
 					}
 				} else if matches!(item, Val::Null) {
-					continue;
 				} else {
 					bail!("in std.join all items should be arrays");
 				}
@@ -226,7 +225,6 @@
 					first = false;
 					write!(out, "{item}").unwrap();
 				} else if matches!(item, Val::Null) {
-					continue;
 				} else {
 					bail!("in std.join all items should be strings");
 				}
modifiedcrates/jrsonnet-stdlib/src/manifest/xml.rsdiffbeforeafterboth
--- a/crates/jrsonnet-stdlib/src/manifest/xml.rs
+++ b/crates/jrsonnet-stdlib/src/manifest/xml.rs
@@ -46,7 +46,7 @@
 		};
 		if arr.is_empty() {
 			bail!("JSONML value should have tag (array length should be >=1)");
-		};
+		}
 		let tag = String::from_untyped(
 			arr.get(0)
 				.description("getting JSONML tag")?
modifiedcrates/jrsonnet-stdlib/src/manifest/yaml.rsdiffbeforeafterboth
--- a/crates/jrsonnet-stdlib/src/manifest/yaml.rs
+++ b/crates/jrsonnet-stdlib/src/manifest/yaml.rs
@@ -90,6 +90,7 @@
 		RESERVED.iter().any(|k| key.eq_ignore_ascii_case(k))
 	}
 
+	#[allow(clippy::if_same_then_else)]
 	// Check for unsafe characters
 	if !key
 		.chars()
@@ -98,7 +99,7 @@
 		return false;
 	}
 	// Check for reserved words
-	if is_reserved(key) {
+	else if is_reserved(key) {
 		return false;
 	}
 	// Check for timestamp values.  Since spaces and colons are already forbidden,
@@ -107,7 +108,7 @@
 	// - all characters match [0-9\-]
 	// - has exactly 2 dashes
 	// are considered dates.
-	if key.chars().all(|v| matches!(v, '0'..='9' | '-')) && count_char(key, '-') == 2 {
+	else if key.chars().all(|v| matches!(v, '0'..='9' | '-')) && count_char(key, '-') == 2 {
 		return false;
 	}
 	// Check for integers.  Keys that meet all of the following:
modifiedcrates/jrsonnet-stdlib/src/misc.rsdiffbeforeafterboth
--- a/crates/jrsonnet-stdlib/src/misc.rs
+++ b/crates/jrsonnet-stdlib/src/misc.rs
@@ -172,7 +172,7 @@
 	let Some(patch) = patch.as_obj() else {
 		return Ok(patch);
 	};
-	let target = target.as_obj().unwrap_or_else(|| ObjValue::empty());
+	let target = target.as_obj().unwrap_or_else(ObjValue::empty);
 	let target_fields = target
 		.fields(
 			// FIXME: Makes no sense to preserve order for BTreeSet, it would be better to use IndexSet here?
modifiedcrates/jrsonnet-stdlib/src/sets.rsdiffbeforeafterboth
--- a/crates/jrsonnet-stdlib/src/sets.rs
+++ b/crates/jrsonnet-stdlib/src/sets.rs
@@ -21,7 +21,7 @@
 	let x = keyF(x)?;
 
 	while low < high {
-		let middle = (high + low) / 2;
+		let middle = usize::midpoint(high, low);
 		let comp = keyF(arr.get_lazy(middle).expect("in bounds"))?;
 		match evaluate_compare_op(&comp, &x, BinaryOpType::Lt)? {
 			Ordering::Less => low = middle + 1,
@@ -66,7 +66,7 @@
 				bv = b.next();
 				bk = bv.map(keyF).transpose()?;
 			}
-		};
+		}
 	}
 	Ok(ArrValue::lazy(out))
 }
@@ -106,7 +106,7 @@
 				bv = b.next();
 				bk = bv.map(keyF).transpose()?;
 			}
-		};
+		}
 	}
 	while let Some(_ac) = &ak {
 		// In a, but not in b
@@ -154,7 +154,7 @@
 				bv = b.next();
 				bk = bv.clone().map(keyF).transpose()?;
 			}
-		};
+		}
 	}
 	// a.len() > b.len()
 	while let Some(_ac) = &ak {
modifiedcrates/jrsonnet-stdlib/src/sort.rsdiffbeforeafterboth
--- a/crates/jrsonnet-stdlib/src/sort.rs
+++ b/crates/jrsonnet-stdlib/src/sort.rs
@@ -66,7 +66,7 @@
 				return Err(err);
 			}
 		}
-	};
+	}
 	Ok(values)
 }
 
@@ -107,7 +107,7 @@
 				return Err(err);
 			}
 		}
-	};
+	}
 	Ok(vk.into_iter().map(|v| v.0).collect())
 }
 
@@ -204,7 +204,7 @@
 	}
 }
 
-fn eval_keyf(val: Val, key_f: &Option<FuncVal>) -> Result<Val> {
+fn eval_keyf(val: Val, key_f: Option<&FuncVal>) -> Result<Val> {
 	if let Some(key_f) = key_f {
 		key_f.evaluate_simple(&(val,), false)
 	} else {
@@ -212,13 +212,13 @@
 	}
 }
 
-fn array_top1(arr: ArrValue, key_f: Option<FuncVal>, ordering: Ordering) -> Result<Val> {
+fn array_top1(arr: ArrValue, key_f: Option<&FuncVal>, ordering: Ordering) -> Result<Val> {
 	let mut iter = arr.iter();
 	let mut min = iter.next().expect("not empty")?;
-	let mut min_key = eval_keyf(min.clone(), &key_f)?;
+	let mut min_key = eval_keyf(min.clone(), key_f)?;
 	for item in iter {
 		let cur = item?;
-		let cur_key = eval_keyf(cur.clone(), &key_f)?;
+		let cur_key = eval_keyf(cur.clone(), key_f)?;
 		if evaluate_compare_op(&cur_key, &min_key, BinaryOpType::Lt)? == ordering {
 			min = cur;
 			min_key = cur_key;
@@ -236,7 +236,7 @@
 	if arr.is_empty() {
 		return eval_on_empty(onEmpty);
 	}
-	array_top1(arr, keyF, Ordering::Less)
+	array_top1(arr, keyF.as_ref(), Ordering::Less)
 }
 #[builtin]
 pub fn builtin_max_array(
@@ -247,5 +247,5 @@
 	if arr.is_empty() {
 		return eval_on_empty(onEmpty);
 	}
-	array_top1(arr, keyF, Ordering::Greater)
+	array_top1(arr, keyF.as_ref(), Ordering::Greater)
 }
modifiedcrates/jrsonnet-stdlib/src/strings.rsdiffbeforeafterboth
--- a/crates/jrsonnet-stdlib/src/strings.rs
+++ b/crates/jrsonnet-stdlib/src/strings.rs
@@ -53,7 +53,7 @@
 
 #[builtin]
 pub fn builtin_equals_ignore_case(str1: String, str2: String) -> bool {
-	str1.to_ascii_lowercase() == str2.to_ascii_lowercase()
+	str1.eq_ignore_ascii_case(&str2)
 }
 
 #[builtin]
modifiedcrates/jrsonnet-types/src/lib.rsdiffbeforeafterboth
--- a/crates/jrsonnet-types/src/lib.rs
+++ b/crates/jrsonnet-types/src/lib.rs
@@ -133,7 +133,7 @@
 			Self::Sum(v) => write_union(f, false, v.iter())?,
 			Self::SumRef(v) => write_union(f, false, v.iter().copied())?,
 			Self::Lazy(lazy) => write!(f, "Lazy<{lazy}>")?,
-		};
+		}
 		Ok(())
 	}
 }
modifiedtests/tests/common.rsdiffbeforeafterboth
--- a/tests/tests/common.rs
+++ b/tests/tests/common.rs
@@ -57,12 +57,13 @@
 #[builtin]
 fn param_names(fun: FuncVal) -> Vec<String> {
 	fun.params()
-		.into_iter()
+		.iter()
 		.map(|v| v.name().as_str().unwrap_or("<unnamed>").to_owned())
 		.collect()
 }
 
 #[derive(Trace)]
+#[allow(dead_code)]
 pub struct ContextInitializer;
 impl ContextInitializerT for ContextInitializer {
 	fn populate(&self, _for_file: Source, builder: &mut ContextBuilder) {
modifiedtests/tests/cpp_test_suite.rsdiffbeforeafterboth
--- a/tests/tests/cpp_test_suite.rs
+++ b/tests/tests/cpp_test_suite.rs
@@ -23,29 +23,29 @@
 	// C++ test suite
 	std_context.add_ext_str("var1".into(), "test".into());
 	std_context
-		.add_ext_code("var2".into(), "{x:1,y:2}")
+		.add_ext_code("var2", "{x:1,y:2}")
 		.expect("code is valid");
 
 	// Golang test suite
 	std_context
-		.add_ext_code("codeVar".into(), "3+3")
+		.add_ext_code("codeVar", "3+3")
 		.expect("code is valid");
 	std_context.add_ext_str("stringVar".into(), "2 + 2".into());
 	std_context
 		.add_ext_code(
-			"selfRecursiveVar".into(),
+			"selfRecursiveVar",
 			r#"[42, std.extVar("selfRecursiveVar")[0] + 1]"#,
 		)
 		.expect("code is valid");
 	std_context
 		.add_ext_code(
-			"mutuallyRecursiveVar1".into(),
+			"mutuallyRecursiveVar1",
 			r#"[42, std.extVar("mutuallyRecursiveVar2")[0] + 1]"#,
 		)
 		.expect("code is valid");
 	std_context
 		.add_ext_code(
-			"mutuallyRecursiveVar2".into(),
+			"mutuallyRecursiveVar2",
 			r#"[42, std.extVar("mutuallyRecursiveVar1")[0] + 1]"#,
 		)
 		.expect("code is valid");
@@ -203,9 +203,9 @@
 		let root = root_tests.join(root_dir);
 		let root_override = root_tests.join(format!("{root_dir}_golden_override"));
 
-		for entry in fs::read_dir(&root).map_err(|e| io::Error::new(ErrorKind::Other, format!("failed to enumerate cpp_test_suite dir (Note: it needs to be cloned from C++ jsonnet repo for this test): {e}")))? {
+		for entry in fs::read_dir(&root).map_err(|e| io::Error::other(format!("failed to enumerate cpp_test_suite dir (Note: it needs to be cloned from C++ jsonnet repo for this test): {e}")))? {
 		let entry = entry?;
-		if !entry.path().extension().map_or(false, |e| e == "jsonnet") {
+		if entry.path().extension().is_none_or(|e| e != "jsonnet") {
 			continue;
 		}
 
@@ -213,7 +213,7 @@
 			.path()
 			.file_name()
 			.and_then(|v| v.to_str())
-			.map_or(false, |v| SKIPPED.contains(&v))
+			.is_some_and(|v| SKIPPED.contains(&v))
 		{
 			continue;
 		}
@@ -227,7 +227,7 @@
 		golden_path2.set_extension("golden");
 
 		let golden_override =
-			root_override.join(&golden_path.file_name().expect("file has basename"));
+			root_override.join(golden_path.file_name().expect("file has basename"));
 
 		// .jsonnet.golden for C++ tests
 		let mut golden = read_file(&golden_path)?;
@@ -282,7 +282,7 @@
 					}
 				}
 			}
-		};
+		}
 	}
 	}
 
modifiedtests/tests/golden.rsdiffbeforeafterboth
--- a/tests/tests/golden.rs
+++ b/tests/tests/golden.rs
@@ -40,8 +40,8 @@
 #[test]
 fn golden() {
 	glob!("../", "golden/*.jsonnet", |path| {
-		let result = run(&path);
+		let result = run(path);
 
-		assert_snapshot!(result)
+		assert_snapshot!(result);
 	});
 }
modifiedtests/tests/suite.rsdiffbeforeafterboth
--- a/tests/tests/suite.rs
+++ b/tests/tests/suite.rs
@@ -32,7 +32,7 @@
 			file.display(),
 			trace_format.format(&e).unwrap()
 		),
-	};
+	}
 }
 
 #[test]
@@ -42,11 +42,9 @@
 
 	for entry in fs::read_dir(&root)? {
 		let entry = entry?;
-		if !entry.path().extension().map_or(false, |e| e == "jsonnet") {
-			continue;
+		if entry.path().extension().is_some_and(|e| e == "jsonnet") {
+			run(&entry.path());
 		}
-
-		run(&entry.path());
 	}
 
 	Ok(())