git.delta.rocks / jrsonnet / refs/commits / 27958b04316f

difftreelog

refactor cleanup

pyypxomoYaroslav Bolyukin2026-03-23parent: #325f0a1.patch.diff
in: master

9 files changed

modifiedbindings/jsonnet/src/lib.rsdiffbeforeafterboth
--- a/bindings/jsonnet/src/lib.rs
+++ b/bindings/jsonnet/src/lib.rs
@@ -45,8 +45,8 @@
 /// If this does not match `LIB_JSONNET_VERSION`
 /// then there is a mismatch between header and compiled library.
 #[no_mangle]
-pub extern "C" fn jsonnet_version() -> &'static [u8; 8] {
-	b"v0.20.0\0"
+pub extern "C" fn jsonnet_version() -> &'static [u8; 12] {
+	b"v0.22.0-rc1\0"
 }
 
 unsafe fn parse_path(input: &CStr) -> Cow<'_, Path> {
modifiedcrates/jrsonnet-evaluator/src/async_import.rsdiffbeforeafterboth
before · crates/jrsonnet-evaluator/src/async_import.rs
1use std::rc::Rc;2use std::{any::Any, cell::RefCell, future::Future};34use jrsonnet_gcmodule::Acyclic;5use jrsonnet_ir::visit::Visitor;6use jrsonnet_ir::{7	ArgsDesc, AssertExpr, AssertStmt, BindSpec, CompSpec, Destruct, Expr, ExprParam, ExprParams,8	FieldMember, FieldName, ForSpecData, IStr, IfElse, IfSpecData, ImportKind, ObjBody, Slice,9	SliceDesc, Source, SourcePath, Spanned,10};11use rustc_hash::FxHashMap;1213use crate::{AsPathLike, FileData, ImportResolver, ResolvePathOwned, State};1415pub struct Import {16	path: ResolvePathOwned,17	expression: bool,18}1920pub struct FoundImports(Vec<Import>);21impl Visitor for FoundImports {22	fn visit_import(&mut self, expression: bool, value: IStr) {23		self.0.push(Import {24			path: ResolvePathOwned::Str(value.to_string()),25			expression,26		})27	}28}2930pub trait AsyncImportResolver {31	type Error;32	/// Resolves file path, e.g. `(/home/user/manifests, b.libjsonnet)` can correspond33	/// both to `/home/user/manifests/b.libjsonnet` and to `/home/user/${vendor}/b.libjsonnet`34	/// where `${vendor}` is a library path.35	///36	/// `from` should only be returned from [`ImportResolver::resolve`],37	/// or from other defined file, any other value may result in panic38	fn resolve_from(39		&self,40		from: &SourcePath,41		path: &dyn AsPathLike,42	) -> impl Future<Output = Result<SourcePath, Self::Error>>;43	fn resolve_from_default(44		&self,45		path: &dyn AsPathLike,46	) -> impl Future<Output = Result<SourcePath, Self::Error>> {47		async { self.resolve_from(&SourcePath::default(), path).await }48	}4950	/// Load resolved file51	/// This should only be called with value returned52	/// from [`ImportResolver::resolve_file`]/[`ImportResolver::resolve`],53	/// this cannot be resolved using associated type,54	/// as the evaluator uses object instead of generic for [`ImportResolver`]55	fn load_file_contents(56		&self,57		resolved: &SourcePath,58	) -> impl Future<Output = Result<Vec<u8>, Self::Error>>;59}6061#[derive(Acyclic)]62struct ResolvedImportResolver {63	resolved: RefCell<FxHashMap<(SourcePath, ResolvePathOwned), (SourcePath, bool)>>,64}65impl ImportResolver for ResolvedImportResolver {66	fn load_file_contents(&self, _resolved: &SourcePath) -> crate::Result<Vec<u8>> {67		unreachable!("all files should be loaded at this point");68	}6970	fn resolve_from(&self, from: &SourcePath, path: &dyn AsPathLike) -> crate::Result<SourcePath> {71		Ok(self72			.resolved73			.borrow()74			.get(&(from.clone(), path.as_path().to_owned()))75			.expect("all imports should be resolved at this point")76			.077			.clone())78	}7980	fn resolve_from_default(&self, path: &dyn AsPathLike) -> crate::Result<SourcePath> {81		self.resolve_from(&SourcePath::default(), path)82	}83}8485enum Job {86	LoadFile { path: SourcePath, parse: bool },87	ParseFile(SourcePath),88	ResolveImport { from: SourcePath, import: Import },89}9091#[allow(clippy::future_not_send)]92pub async fn async_import<H>(s: State, handler: H, path: &dyn AsPathLike) -> Result<(), H::Error>93where94	H: AsyncImportResolver,95{96	let resolved = (s.import_resolver() as &dyn Any)97		.downcast_ref::<ResolvedImportResolver>()98		.expect("for async imports, import_resolver should be set to ResolvedImportResolver");99100	let mut queue = vec![Job::LoadFile {101		path: handler.resolve_from_default(path).await?,102		parse: true,103	}];104	while let Some(job) = queue.pop() {105		match job {106			Job::LoadFile { path, parse } => {107				if !s.0.file_cache.borrow().contains_key(&path) {108					let data = handler.load_file_contents(&path).await?;109					s.0.file_cache110						.borrow_mut()111						.insert(path.clone(), FileData::new_bytes(data.as_slice().into()));112				}113				if parse {114					queue.push(Job::ParseFile(path));115				}116			}117			Job::ParseFile(path) => {118				if let Some(file) = s.0.file_cache.borrow_mut().get_mut(&path) {119					if file.parsed.is_none() {120						let Some(code) = file.get_string() else {121							continue;122						};123						let source = Source::new(path.clone(), code.clone());124						// If failed - then skip import125						file.parsed = crate::parse_jsonnet(&code, source).map(Rc::new).ok();126						if let Some(parsed) = &file.parsed {127							let mut imports = FoundImports(vec![]);128							imports.visit_expr(parsed);129							for import in imports.0 {130								queue.push(Job::ResolveImport {131									from: path.clone(),132									import,133								});134							}135						}136					}137				}138			}139			Job::ResolveImport { from, import } => {140				{141					let mut resolved_map = resolved.resolved.borrow_mut();142					if let Some((resolved, expression)) =143						resolved_map.get_mut(&(from.clone(), import.path.clone()))144					{145						if import.expression && !*expression {146							*expression = true;147							queue.push(Job::ParseFile(resolved.clone()));148						}149						continue;150					}151				}152				let resolved = handler.resolve_from(&from, &import.path).await?;153				queue.push(Job::LoadFile {154					path: resolved,155					parse: import.expression,156				});157			}158		}159	}160	Ok(())161}
after · crates/jrsonnet-evaluator/src/async_import.rs
1use std::rc::Rc;2use std::{any::Any, cell::RefCell, future::Future};34use jrsonnet_gcmodule::Acyclic;5use jrsonnet_ir::visit::Visitor;6use jrsonnet_ir::{IStr, Source, SourcePath};7use rustc_hash::FxHashMap;89use crate::{AsPathLike, FileData, ImportResolver, ResolvePathOwned, State};1011pub struct Import {12	path: ResolvePathOwned,13	expression: bool,14}1516pub struct FoundImports(Vec<Import>);17impl Visitor for FoundImports {18	fn visit_import(&mut self, expression: bool, value: IStr) {19		self.0.push(Import {20			path: ResolvePathOwned::Str(value.to_string()),21			expression,22		});23	}24}2526pub trait AsyncImportResolver {27	type Error;28	/// Resolves file path, e.g. `(/home/user/manifests, b.libjsonnet)` can correspond29	/// both to `/home/user/manifests/b.libjsonnet` and to `/home/user/${vendor}/b.libjsonnet`30	/// where `${vendor}` is a library path.31	///32	/// `from` should only be returned from [`ImportResolver::resolve`],33	/// or from other defined file, any other value may result in panic34	fn resolve_from(35		&self,36		from: &SourcePath,37		path: &dyn AsPathLike,38	) -> impl Future<Output = Result<SourcePath, Self::Error>>;39	fn resolve_from_default(40		&self,41		path: &dyn AsPathLike,42	) -> impl Future<Output = Result<SourcePath, Self::Error>> {43		async { self.resolve_from(&SourcePath::default(), path).await }44	}4546	/// Load resolved file47	/// This should only be called with value returned48	/// from [`ImportResolver::resolve_file`]/[`ImportResolver::resolve`],49	/// this cannot be resolved using associated type,50	/// as the evaluator uses object instead of generic for [`ImportResolver`]51	fn load_file_contents(52		&self,53		resolved: &SourcePath,54	) -> impl Future<Output = Result<Vec<u8>, Self::Error>>;55}5657#[derive(Acyclic)]58struct ResolvedImportResolver {59	resolved: RefCell<FxHashMap<(SourcePath, ResolvePathOwned), (SourcePath, bool)>>,60}61impl ImportResolver for ResolvedImportResolver {62	fn load_file_contents(&self, _resolved: &SourcePath) -> crate::Result<Vec<u8>> {63		unreachable!("all files should be loaded at this point");64	}6566	fn resolve_from(&self, from: &SourcePath, path: &dyn AsPathLike) -> crate::Result<SourcePath> {67		Ok(self68			.resolved69			.borrow()70			.get(&(from.clone(), path.as_path().to_owned()))71			.expect("all imports should be resolved at this point")72			.073			.clone())74	}7576	fn resolve_from_default(&self, path: &dyn AsPathLike) -> crate::Result<SourcePath> {77		self.resolve_from(&SourcePath::default(), path)78	}79}8081enum Job {82	LoadFile { path: SourcePath, parse: bool },83	ParseFile(SourcePath),84	ResolveImport { from: SourcePath, import: Import },85}8687#[allow(clippy::future_not_send)]88pub async fn async_import<H>(s: State, handler: H, path: &dyn AsPathLike) -> Result<(), H::Error>89where90	H: AsyncImportResolver,91{92	let resolved = (s.import_resolver() as &dyn Any)93		.downcast_ref::<ResolvedImportResolver>()94		.expect("for async imports, import_resolver should be set to ResolvedImportResolver");9596	let mut queue = vec![Job::LoadFile {97		path: handler.resolve_from_default(path).await?,98		parse: true,99	}];100	while let Some(job) = queue.pop() {101		match job {102			Job::LoadFile { path, parse } => {103				if !s.0.file_cache.borrow().contains_key(&path) {104					let data = handler.load_file_contents(&path).await?;105					s.0.file_cache106						.borrow_mut()107						.insert(path.clone(), FileData::new_bytes(data.as_slice().into()));108				}109				if parse {110					queue.push(Job::ParseFile(path));111				}112			}113			Job::ParseFile(path) => {114				if let Some(file) = s.0.file_cache.borrow_mut().get_mut(&path) {115					if file.parsed.is_none() {116						let Some(code) = file.get_string() else {117							continue;118						};119						let source = Source::new(path.clone(), code.clone());120						// If failed - then skip import121						file.parsed = crate::parse_jsonnet(&code, source).map(Rc::new).ok();122						if let Some(parsed) = &file.parsed {123							let mut imports = FoundImports(vec![]);124							imports.visit_expr(parsed);125							for import in imports.0 {126								queue.push(Job::ResolveImport {127									from: path.clone(),128									import,129								});130							}131						}132					}133				}134			}135			Job::ResolveImport { from, import } => {136				{137					let mut resolved_map = resolved.resolved.borrow_mut();138					if let Some((resolved, expression)) =139						resolved_map.get_mut(&(from.clone(), import.path.clone()))140					{141						if import.expression && !*expression {142							*expression = true;143							queue.push(Job::ParseFile(resolved.clone()));144						}145						continue;146					}147				}148				let resolved = handler.resolve_from(&from, &import.path).await?;149				queue.push(Job::LoadFile {150					path: resolved,151					parse: import.expression,152				});153			}154		}155	}156	Ok(())157}
modifiedcrates/jrsonnet-evaluator/src/lib.rsdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/lib.rs
+++ b/crates/jrsonnet-evaluator/src/lib.rs
@@ -5,7 +5,7 @@
 extern crate self as jrsonnet_evaluator;
 
 mod arr;
-// pub mod async_import;
+pub mod async_import;
 mod ctx;
 mod dynamic;
 pub mod error;
modifiedcrates/jrsonnet-evaluator/src/obj/mod.rsdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/obj/mod.rs
+++ b/crates/jrsonnet-evaluator/src/obj/mod.rs
@@ -1,5 +1,13 @@
 use std::{
-	any::Any, cell::{Cell, RefCell}, clone::Clone, cmp::Reverse, collections::hash_map::Entry, fmt::{self, Debug}, hash::{Hash, Hasher}, num::Saturating, ops::ControlFlow
+	any::Any,
+	cell::{Cell, RefCell},
+	clone::Clone,
+	cmp::Reverse,
+	collections::hash_map::Entry,
+	fmt::{self, Debug},
+	hash::{Hash, Hasher},
+	num::Saturating,
+	ops::ControlFlow,
 };
 
 use educe::Educe;
modifiedcrates/jrsonnet-ir-parser/src/lib.rsdiffbeforeafterboth
--- a/crates/jrsonnet-ir-parser/src/lib.rs
+++ b/crates/jrsonnet-ir-parser/src/lib.rs
@@ -3,9 +3,9 @@
 use jrsonnet_gcmodule::Acyclic;
 use jrsonnet_ir::{
 	unescape, ArgsDesc, AssertExpr, AssertStmt, BinaryOp, BinaryOpType, BindSpec, CompSpec,
-	Destruct, DestructRest, Expr, ExprParam, ExprParams, FieldMember, FieldName, ForSpecData, IStr,
-	IfElse, IfSpecData, ImportKind, IndexPart, LiteralType, Member, ObjBody, ObjComp, ObjMembers,
-	Slice, SliceDesc, Source, Span, Spanned, UnaryOpType, Visibility,
+	Destruct, Expr, ExprParam, ExprParams, FieldMember, FieldName, ForSpecData, IStr, IfElse,
+	IfSpecData, ImportKind, IndexPart, LiteralType, Member, ObjBody, ObjComp, ObjMembers, Slice,
+	SliceDesc, Source, Span, Spanned, UnaryOpType, Visibility,
 };
 use jrsonnet_lexer::{collect_lexed_str_block, Lexeme, Lexer, SyntaxKind, T};
 
@@ -30,7 +30,7 @@
 	}
 }
 
-type R<T> = Result<T, ParseError>;
+type Result<T> = std::result::Result<T, ParseError>;
 
 struct Parser<'a> {
 	lexemes: Vec<Lexeme<'a>>,
@@ -103,7 +103,7 @@
 		}
 	}
 
-	fn eat(&mut self, t: SyntaxKind) -> R<()> {
+	fn eat(&mut self, t: SyntaxKind) -> Result<()> {
 		if !self.at(t) {
 			return Err(self.error(format!(
 				"expected {}, got {}",
@@ -138,15 +138,13 @@
 		}
 	}
 
-	fn expect_ident(&mut self) -> R<IStr> {
+	fn expect_ident(&mut self) -> Result<IStr> {
 		if !self.at(SyntaxKind::IDENT) {
 			return Err(self.error(format!("expected identifier, got {}", self.current_desc())));
 		}
 		let text = self.text();
 		if is_reserved(text) {
-			return Err(self.error(format!(
-				"expected identifier, got reserved word '{text}'"
-			)));
+			return Err(self.error(format!("expected identifier, got reserved word '{text}'")));
 		}
 		let s: IStr = text.into();
 		self.eat_any();
@@ -164,36 +162,38 @@
 		"assert"
 			| "else" | "error"
 			| "false" | "for"
-			| "function" | "if"
-			| "import" | "importstr"
-			| "importbin" | "in"
-			| "local" | "null"
-			| "tailstrict" | "then"
-			| "self" | "super"
-			| "true"
+			| "function"
+			| "if" | "import"
+			| "importstr"
+			| "importbin"
+			| "in" | "local"
+			| "null" | "tailstrict"
+			| "then" | "self"
+			| "super" | "true"
 	)
 }
 
-fn spanned<T: Acyclic>(p: &mut Parser<'_>, cb: impl FnOnce(&mut Parser<'_>) -> R<T>) -> R<Spanned<T>> {
+fn spanned<T: Acyclic>(
+	p: &mut Parser<'_>,
+	cb: impl FnOnce(&mut Parser<'_>) -> Result<T>,
+) -> Result<Spanned<T>> {
 	let start = p.span_start();
 	let v = cb(p)?;
 	let end = p.span_end();
 	Ok(Spanned::new(v, Span(p.source.clone(), start, end)))
 }
 
-fn parse_string_content(p: &mut Parser<'_>) -> R<IStr> {
+fn parse_string_content(p: &mut Parser<'_>) -> Result<IStr> {
 	let kind = p.peek();
 	let text = p.text();
 	let s = match kind {
 		SyntaxKind::STRING_DOUBLE => {
 			let inner = &text[1..text.len() - 1];
-			unescape::unescape(inner)
-				.ok_or_else(|| p.error("invalid string escape".into()))?
+			unescape::unescape(inner).ok_or_else(|| p.error("invalid string escape".into()))?
 		}
 		SyntaxKind::STRING_SINGLE => {
 			let inner = &text[1..text.len() - 1];
-			unescape::unescape(inner)
-				.ok_or_else(|| p.error("invalid string escape".into()))?
+			unescape::unescape(inner).ok_or_else(|| p.error("invalid string escape".into()))?
 		}
 		SyntaxKind::STRING_DOUBLE_VERBATIM => {
 			let inner = &text[2..text.len() - 1];
@@ -236,7 +236,7 @@
 	)
 }
 
-fn parse_number(p: &mut Parser<'_>) -> R<f64> {
+fn parse_number(p: &mut Parser<'_>) -> Result<f64> {
 	let text = p.text();
 	let n: f64 = text
 		.replace('_', "")
@@ -263,7 +263,7 @@
 	Some(t)
 }
 
-fn assert_stmt(p: &mut Parser<'_>) -> R<AssertStmt> {
+fn assert_stmt(p: &mut Parser<'_>) -> Result<AssertStmt> {
 	p.eat(T![assert])?;
 	let cond = spanned(p, expr)?;
 	let msg = if p.try_eat(T![:]) {
@@ -274,13 +274,13 @@
 	Ok(AssertStmt(cond, msg))
 }
 
-fn if_spec_data(p: &mut Parser<'_>) -> R<IfSpecData> {
+fn if_spec_data(p: &mut Parser<'_>) -> Result<IfSpecData> {
 	let v = spanned(p, |p| p.eat(T![if]))?;
 	let cond = expr(p)?;
 	Ok(IfSpecData { span: v.span, cond })
 }
 
-fn if_else(p: &mut Parser<'_>) -> R<IfElse> {
+fn if_else(p: &mut Parser<'_>) -> Result<IfElse> {
 	let cond = if_spec_data(p)?;
 	p.eat(T![then])?;
 	let cond_then = expr(p)?;
@@ -296,7 +296,7 @@
 	})
 }
 
-fn slice_desc(p: &mut Parser<'_>, start: Option<Spanned<Expr>>) -> R<SliceDesc> {
+fn slice_desc(p: &mut Parser<'_>, start: Option<Spanned<Expr>>) -> Result<SliceDesc> {
 	p.eat(T![:])?;
 	let end = if !p.at(T![:]) && !p.at(T![']']) {
 		Some(spanned(p, expr)?)
@@ -315,15 +315,12 @@
 	Ok(SliceDesc { start, end, step })
 }
 
-fn destruct(p: &mut Parser<'_>) -> R<Destruct> {
+fn destruct(p: &mut Parser<'_>) -> Result<Destruct> {
 	if p.at_ident() {
 		return Ok(Destruct::Full(p.expect_ident()?));
 	}
 	#[cfg(not(feature = "exp-destruct"))]
-	return Err(p.error(format!(
-		"expected identifier, got {}",
-		p.current_desc()
-	)));
+	return Err(p.error(format!("expected identifier, got {}", p.current_desc())));
 	#[cfg(feature = "exp-destruct")]
 	{
 		if p.try_eat(T![?]) {
@@ -343,17 +340,17 @@
 }
 
 #[cfg(feature = "exp-destruct")]
-fn destruct_rest(p: &mut Parser<'_>) -> R<DestructRest> {
+fn destruct_rest(p: &mut Parser<'_>) -> Result<jrsonnet_ir::DestructRest> {
 	p.eat(T![...])?;
 	if p.at_ident() {
-		Ok(DestructRest::Keep(p.expect_ident()?))
+		Ok(jrsonnet_ir::DestructRest::Keep(p.expect_ident()?))
 	} else {
-		Ok(DestructRest::Drop)
+		Ok(jrsonnet_ir::DestructRest::Drop)
 	}
 }
 
 #[cfg(feature = "exp-destruct")]
-fn destruct_array(p: &mut Parser<'_>) -> R<Destruct> {
+fn destruct_array(p: &mut Parser<'_>) -> Result<Destruct> {
 	p.eat(T!['['])?;
 	let mut start = Vec::new();
 	let mut rest = None;
@@ -391,7 +388,7 @@
 }
 
 #[cfg(feature = "exp-destruct")]
-fn destruct_object(p: &mut Parser<'_>) -> R<Destruct> {
+fn destruct_object(p: &mut Parser<'_>) -> Result<Destruct> {
 	p.eat(T!['{'])?;
 	let mut fields = Vec::new();
 	let mut rest = None;
@@ -426,7 +423,7 @@
 	Ok(Destruct::Object { fields, rest })
 }
 
-fn params(p: &mut Parser<'_>) -> R<ExprParams> {
+fn params(p: &mut Parser<'_>) -> Result<ExprParams> {
 	if p.at(T![')']) {
 		return Ok(ExprParams::new(Vec::new()));
 	}
@@ -452,7 +449,7 @@
 	Ok(ExprParams::new(result))
 }
 
-fn args(p: &mut Parser<'_>) -> R<ArgsDesc> {
+fn args(p: &mut Parser<'_>) -> Result<ArgsDesc> {
 	if p.at(T![')']) {
 		return Ok(ArgsDesc::new(Vec::new(), Vec::new()));
 	}
@@ -489,7 +486,7 @@
 	Ok(ArgsDesc::new(unnamed, named))
 }
 
-fn bind(p: &mut Parser<'_>) -> R<BindSpec> {
+fn bind(p: &mut Parser<'_>) -> Result<BindSpec> {
 	#[cfg(feature = "exp-destruct")]
 	{
 		if !p.at_ident() {
@@ -520,7 +517,7 @@
 	}
 }
 
-fn visibility(p: &mut Parser<'_>) -> R<Visibility> {
+fn visibility(p: &mut Parser<'_>) -> Result<Visibility> {
 	p.eat(T![:])?;
 	if p.try_eat(T![:]) {
 		if p.try_eat(T![:]) {
@@ -533,7 +530,7 @@
 	}
 }
 
-fn field_name(p: &mut Parser<'_>) -> R<FieldName> {
+fn field_name(p: &mut Parser<'_>) -> Result<FieldName> {
 	if p.at_ident() {
 		Ok(FieldName::Fixed(p.expect_ident()?))
 	} else if is_string_token(p.peek()) {
@@ -548,7 +545,7 @@
 	}
 }
 
-fn field(p: &mut Parser<'_>) -> R<FieldMember> {
+fn field(p: &mut Parser<'_>) -> Result<FieldMember> {
 	let name = spanned(p, field_name)?;
 
 	if p.at(T!['(']) {
@@ -578,7 +575,7 @@
 	}
 }
 
-fn member(p: &mut Parser<'_>) -> R<Member> {
+fn member(p: &mut Parser<'_>) -> Result<Member> {
 	if p.at(T![local]) {
 		p.eat(T![local])?;
 		Ok(Member::BindStmt(bind(p)?))
@@ -589,7 +586,7 @@
 	}
 }
 
-fn for_spec(p: &mut Parser<'_>) -> R<ForSpecData> {
+fn for_spec(p: &mut Parser<'_>) -> Result<ForSpecData> {
 	p.eat(T![for])?;
 	let d = destruct(p)?;
 	p.eat(T![in])?;
@@ -597,7 +594,7 @@
 	Ok(ForSpecData { destruct: d, over })
 }
 
-fn compspecs(p: &mut Parser<'_>) -> R<Vec<CompSpec>> {
+fn compspecs(p: &mut Parser<'_>) -> Result<Vec<CompSpec>> {
 	let mut specs = Vec::new();
 	specs.push(CompSpec::ForSpec(for_spec(p)?));
 	loop {
@@ -613,7 +610,7 @@
 	Ok(specs)
 }
 
-fn objinside(p: &mut Parser<'_>) -> R<ObjBody> {
+fn objinside(p: &mut Parser<'_>) -> Result<ObjBody> {
 	if p.at(T!['}']) {
 		return Ok(ObjBody::MemberList(ObjMembers {
 			locals: Rc::new(Vec::new()),
@@ -641,26 +638,22 @@
 			match m {
 				Member::Field(f) => {
 					if field_member.is_some() {
-						return Err(p.error(
-							"object comprehension can only contain one field".into(),
-						));
+						return Err(
+							p.error("object comprehension can only contain one field".into())
+						);
 					}
 					field_member = Some(f);
 				}
 				Member::BindStmt(b) => locals.push(b),
 				Member::AssertStmt(_) => {
-					return Err(p.error(
-						"asserts are unsupported in object comprehension".into(),
-					));
+					return Err(p.error("asserts are unsupported in object comprehension".into()));
 				}
 			}
 		}
 		Ok(ObjBody::ObjComp(ObjComp {
 			locals: Rc::new(locals),
 			field: Rc::new(
-				field_member.ok_or_else(|| {
-					p.error("missing object comprehension field".into())
-				})?,
+				field_member.ok_or_else(|| p.error("missing object comprehension field".into()))?,
 			),
 			compspecs: specs,
 		}))
@@ -683,7 +676,7 @@
 	}
 }
 
-fn expr_basic(p: &mut Parser<'_>) -> R<Expr> {
+fn expr_basic(p: &mut Parser<'_>) -> Result<Expr> {
 	if let Some(lit) = literal(p) {
 		return Ok(Expr::Literal(lit));
 	}
@@ -825,7 +818,6 @@
 	}
 }
 
-/// Flush accumulated index parts into an Expr::Index wrapping `e`.
 fn flush_index_parts(e: &mut Expr, parts: &mut Vec<IndexPart>) {
 	if parts.is_empty() {
 		return;
@@ -837,7 +829,7 @@
 	};
 }
 
-fn expr_suffix(p: &mut Parser<'_>) -> R<Expr> {
+fn expr_suffix(p: &mut Parser<'_>) -> Result<Expr> {
 	let mut e = expr_basic(p)?;
 	// Accumulate consecutive index parts (.field, [expr], ?.field, ?.[expr])
 	// into a single Expr::Index. This is critical for null-coalesce semantics:
@@ -1006,7 +998,7 @@
 	}
 }
 
-fn expr_bp(p: &mut Parser<'_>, min_bp: u8) -> R<Expr> {
+fn expr_bp(p: &mut Parser<'_>, min_bp: u8) -> Result<Expr> {
 	let mut lhs = if let Some(op) = unary_op(p.peek()) {
 		p.eat_any();
 		let rbp = prefix_binding_power(op);
@@ -1038,11 +1030,11 @@
 	Ok(lhs)
 }
 
-fn expr(p: &mut Parser<'_>) -> R<Expr> {
+fn expr(p: &mut Parser<'_>) -> Result<Expr> {
 	expr_bp(p, 0)
 }
 
-pub fn parse(str: &str, settings: &ParserSettings) -> Result<Expr, ParseError> {
+pub fn parse(str: &str, settings: &ParserSettings) -> Result<Expr> {
 	let mut p = Parser::new(str, settings.source.clone());
 	for lexeme in &p.lexemes {
 		if let Some(desc) = lexeme.kind.error_description() {
@@ -1056,20 +1048,14 @@
 	}
 	let e = expr(&mut p)?;
 	if !p.at_eof() {
-		return Err(p.error(format!(
-			"expected end of file, got {}",
-			p.current_desc(),
-		)));
+		return Err(p.error(format!("expected end of file, got {}", p.current_desc(),)));
 	}
 	Ok(e)
 }
 
 pub fn string_to_expr(s: IStr, settings: &ParserSettings) -> Spanned<Expr> {
 	let len = s.len();
-	Spanned::new(
-		Expr::Str(s),
-		Span(settings.source.clone(), 0, len as u32),
-	)
+	Spanned::new(Expr::Str(s), Span(settings.source.clone(), 0, len as u32))
 }
 
 #[cfg(test)]
modifiedcrates/jrsonnet-ir/src/visit.rsdiffbeforeafterboth
--- a/crates/jrsonnet-ir/src/visit.rs
+++ b/crates/jrsonnet-ir/src/visit.rs
@@ -21,6 +21,7 @@
 	}
 }
 
+#[allow(unused_variables, reason = "used with exp-destruct")]
 pub fn visit_destruct<V: Visitor>(v: &mut V, destruct: &Destruct) {
 	match destruct {
 		Destruct::Full(_istr) => {}
modifiedcrates/jrsonnet-rowan-parser/src/lex.rsdiffbeforeafterboth
--- a/crates/jrsonnet-rowan-parser/src/lex.rs
+++ b/crates/jrsonnet-rowan-parser/src/lex.rs
@@ -11,9 +11,11 @@
 }
 
 pub fn lex(input: &str) -> Vec<Lexeme<'_>> {
-	Lexer::new(input).map(|l| Lexeme {
-		kind: SyntaxKind::from_raw(l.kind.into_raw()),
-		text: l.text,
-		range: TextRange::new(TextSize::from(l.range.0), TextSize::from(l.range.1)),
-	}).collect()
+	Lexer::new(input)
+		.map(|l| Lexeme {
+			kind: SyntaxKind::from_raw(l.kind.into_raw()),
+			text: l.text,
+			range: TextRange::new(TextSize::from(l.range.0), TextSize::from(l.range.1)),
+		})
+		.collect()
 }
modifiedcrates/jrsonnet-stdlib/src/manifest/ini.rsdiffbeforeafterboth
--- a/crates/jrsonnet-stdlib/src/manifest/ini.rs
+++ b/crates/jrsonnet-stdlib/src/manifest/ini.rs
@@ -3,8 +3,7 @@
 use jrsonnet_evaluator::{
 	manifest::{ManifestFormat, ToStringFormat},
 	typed::{FromUntyped, Typed},
-	ObjValue, Result, ResultExt, Val,
-	IStr,
+	IStr, ObjValue, Result, ResultExt, Val,
 };
 
 pub struct IniFormat {
modifiedxtask/src/sourcegen/kinds.rsdiffbeforeafterboth
--- a/xtask/src/sourcegen/kinds.rs
+++ b/xtask/src/sourcegen/kinds.rs
@@ -120,11 +120,15 @@
 			Self::Literal { name, .. } => match name.as_str() {
 				"FLOAT" => "number".to_owned(),
 				"IDENT" => "identifier".to_owned(),
-				"STRING_DOUBLE" | "STRING_SINGLE" | "STRING_DOUBLE_VERBATIM"
-				| "STRING_SINGLE_VERBATIM" | "STRING_BLOCK" => "string".to_owned(),
+				"STRING_DOUBLE"
+				| "STRING_SINGLE"
+				| "STRING_DOUBLE_VERBATIM"
+				| "STRING_SINGLE_VERBATIM"
+				| "STRING_BLOCK" => "string".to_owned(),
 				"WHITESPACE" => "whitespace".to_owned(),
-				"SINGLE_LINE_SLASH_COMMENT" | "SINGLE_LINE_HASH_COMMENT"
-				| "MULTI_LINE_COMMENT" => "comment".to_owned(),
+				"SINGLE_LINE_SLASH_COMMENT" | "SINGLE_LINE_HASH_COMMENT" | "MULTI_LINE_COMMENT" => {
+					"comment".to_owned()
+				}
 				_ => name.to_lowercase(),
 			},
 			Self::Meta { name, .. } => name.to_lowercase(),