git.delta.rocks / jrsonnet / refs/commits / 80f37a416bf7

difftreelog

style enforce import style

Yaroslav Bolyukin2022-04-20parent: #4c00868.patch.diff
in: master

38 files changed

modified.rustfmt.tomldiffbeforeafterboth
--- a/.rustfmt.toml
+++ b/.rustfmt.toml
@@ -1 +1,3 @@
 hard_tabs = true
+imports_granularity = "crate"
+group_imports = "stdexternalcrate"
modifiedbindings/jsonnet/src/import.rsdiffbeforeafterboth
--- a/bindings/jsonnet/src/import.rs
+++ b/bindings/jsonnet/src/import.rs
@@ -1,9 +1,5 @@
 //! Import resolution manipulation utilities
 
-use jrsonnet_evaluator::{
-	error::{Error::*, Result},
-	throw, EvaluationState, ImportResolver,
-};
 use std::{
 	any::Any,
 	cell::RefCell,
@@ -17,6 +13,11 @@
 	rc::Rc,
 };
 
+use jrsonnet_evaluator::{
+	error::{Error::*, Result},
+	throw, EvaluationState, ImportResolver,
+};
+
 pub type JsonnetImportCallback = unsafe extern "C" fn(
 	ctx: *mut c_void,
 	base: *const c_char,
modifiedbindings/jsonnet/src/interop.rsdiffbeforeafterboth
--- a/bindings/jsonnet/src/interop.rs
+++ b/bindings/jsonnet/src/interop.rs
@@ -1,12 +1,14 @@
 //! Jrsonnet specific additional binding helpers
 
-use crate::{import::jsonnet_import_callback, native::jsonnet_native_callback};
-use jrsonnet_evaluator::{EvaluationState, Val};
 use std::{
 	ffi::c_void,
 	os::raw::{c_char, c_int},
 };
 
+use jrsonnet_evaluator::{EvaluationState, Val};
+
+use crate::{import::jsonnet_import_callback, native::jsonnet_native_callback};
+
 extern "C" {
 	pub fn _jrsonnet_static_import_callback(
 		ctx: *mut c_void,
modifiedbindings/jsonnet/src/lib.rsdiffbeforeafterboth
--- a/bindings/jsonnet/src/lib.rs
+++ b/bindings/jsonnet/src/lib.rs
@@ -8,8 +8,6 @@
 pub mod val_modify;
 pub mod vars_tlas;
 
-use import::NativeImportResolver;
-use jrsonnet_evaluator::{EvaluationState, IStr, ManifestFormat, Val};
 use std::{
 	alloc::Layout,
 	ffi::{CStr, CString},
@@ -17,6 +15,9 @@
 	path::PathBuf,
 };
 
+use import::NativeImportResolver;
+use jrsonnet_evaluator::{EvaluationState, IStr, ManifestFormat, Val};
+
 /// WASM stub
 #[cfg(target_arch = "wasm32")]
 #[no_mangle]
modifiedbindings/jsonnet/src/native.rsdiffbeforeafterboth
--- a/bindings/jsonnet/src/native.rs
+++ b/bindings/jsonnet/src/native.rs
@@ -1,3 +1,11 @@
+use std::{
+	convert::TryFrom,
+	ffi::{c_void, CStr},
+	os::raw::{c_char, c_int},
+	path::Path,
+	rc::Rc,
+};
+
 use gcmodule::Cc;
 use jrsonnet_evaluator::{
 	error::{Error, LocError},
@@ -5,13 +13,6 @@
 	gc::TraceBox,
 	native::{NativeCallback, NativeCallbackHandler},
 	EvaluationState, IStr, Val,
-};
-use std::{
-	convert::TryFrom,
-	ffi::{c_void, CStr},
-	os::raw::{c_char, c_int},
-	path::Path,
-	rc::Rc,
 };
 
 type JsonnetNativeCallback = unsafe extern "C" fn(
modifiedbindings/jsonnet/src/val_extract.rsdiffbeforeafterboth
--- a/bindings/jsonnet/src/val_extract.rs
+++ b/bindings/jsonnet/src/val_extract.rs
@@ -1,12 +1,12 @@
 //! Extract values from VM
 
-use jrsonnet_evaluator::{EvaluationState, Val};
-
 use std::{
 	ffi::CString,
 	os::raw::{c_char, c_double, c_int},
 };
 
+use jrsonnet_evaluator::{EvaluationState, Val};
+
 #[no_mangle]
 pub extern "C" fn jsonnet_json_extract_string(_vm: &EvaluationState, v: &Val) -> *mut c_char {
 	match v {
modifiedbindings/jsonnet/src/val_make.rsdiffbeforeafterboth
--- a/bindings/jsonnet/src/val_make.rs
+++ b/bindings/jsonnet/src/val_make.rs
@@ -1,12 +1,13 @@
 //! Create values in VM
 
-use gcmodule::Cc;
-use jrsonnet_evaluator::{ArrValue, EvaluationState, ObjValue, Val};
 use std::{
 	ffi::CStr,
 	os::raw::{c_char, c_double, c_int},
 };
 
+use gcmodule::Cc;
+use jrsonnet_evaluator::{val::ArrValue, EvaluationState, ObjValue, Val};
+
 /// # Safety
 ///
 /// This function is safe, if received v is a pointer to normal C string
modifiedbindings/jsonnet/src/val_modify.rsdiffbeforeafterboth
--- a/bindings/jsonnet/src/val_modify.rs
+++ b/bindings/jsonnet/src/val_modify.rs
@@ -2,10 +2,11 @@
 //! Only tested with variables, which haven't altered by code before appearing here
 //! In jrsonnet every value is immutable, and this code is probally broken
 
+use std::{ffi::CStr, os::raw::c_char};
+
 use gcmodule::Cc;
-use jrsonnet_evaluator::{ArrValue, EvaluationState, LazyBinding, LazyVal, ObjMember, Val};
+use jrsonnet_evaluator::{val::ArrValue, EvaluationState, LazyBinding, LazyVal, ObjMember, Val};
 use jrsonnet_parser::Visibility;
-use std::{ffi::CStr, os::raw::c_char};
 
 /// # Safety
 ///
modifiedbindings/jsonnet/src/vars_tlas.rsdiffbeforeafterboth
--- a/bindings/jsonnet/src/vars_tlas.rs
+++ b/bindings/jsonnet/src/vars_tlas.rs
@@ -1,8 +1,9 @@
 //! Manipulate external variables and top level arguments
 
-use jrsonnet_evaluator::EvaluationState;
 use std::{ffi::CStr, os::raw::c_char};
 
+use jrsonnet_evaluator::EvaluationState;
+
 /// # Safety
 #[no_mangle]
 pub unsafe extern "C" fn jsonnet_ext_var(
modifiedcmds/jrsonnet/src/main.rsdiffbeforeafterboth
--- a/cmds/jrsonnet/src/main.rs
+++ b/cmds/jrsonnet/src/main.rs
@@ -1,13 +1,13 @@
+use std::{
+	fs::{create_dir_all, File},
+	io::{Read, Write},
+	path::PathBuf,
+};
+
 use clap::{AppSettings, IntoApp, Parser};
 use clap_complete::Shell;
 use jrsonnet_cli::{ConfigureState, GcOpts, GeneralOpts, InputOpts, ManifestOpts, OutputOpts};
 use jrsonnet_evaluator::{error::LocError, EvaluationState};
-use std::{
-	fs::{create_dir_all, File},
-	io::Read,
-	io::Write,
-	path::PathBuf,
-};
 
 #[cfg(feature = "mimalloc")]
 #[global_allocator]
modifiedcrates/jrsonnet-cli/src/ext.rsdiffbeforeafterboth
--- a/crates/jrsonnet-cli/src/ext.rs
+++ b/crates/jrsonnet-cli/src/ext.rs
@@ -1,8 +1,10 @@
-use crate::ConfigureState;
+use std::{fs::read_to_string, str::FromStr};
+
 use clap::Parser;
 use jrsonnet_evaluator::{error::Result, EvaluationState};
-use std::{fs::read_to_string, str::FromStr};
 
+use crate::ConfigureState;
+
 #[derive(Clone)]
 pub struct ExtStr {
 	pub name: String,
modifiedcrates/jrsonnet-cli/src/lib.rsdiffbeforeafterboth
--- a/crates/jrsonnet-cli/src/lib.rs
+++ b/crates/jrsonnet-cli/src/lib.rs
@@ -3,14 +3,14 @@
 mod tla;
 mod trace;
 
+use std::{env, path::PathBuf};
+
+use clap::Parser;
 pub use ext::*;
+use jrsonnet_evaluator::{error::Result, EvaluationState, FileImportResolver};
 pub use manifest::*;
 pub use tla::*;
 pub use trace::*;
-
-use clap::Parser;
-use jrsonnet_evaluator::{error::Result, EvaluationState, FileImportResolver};
-use std::{env, path::PathBuf};
 
 pub trait ConfigureState {
 	fn configure(&self, state: &EvaluationState) -> Result<()>;
modifiedcrates/jrsonnet-cli/src/manifest.rsdiffbeforeafterboth
--- a/crates/jrsonnet-cli/src/manifest.rs
+++ b/crates/jrsonnet-cli/src/manifest.rs
@@ -1,8 +1,10 @@
-use crate::ConfigureState;
+use std::{path::PathBuf, str::FromStr};
+
 use clap::Parser;
 use jrsonnet_evaluator::{error::Result, EvaluationState, ManifestFormat};
-use std::{path::PathBuf, str::FromStr};
 
+use crate::ConfigureState;
+
 pub enum ManifestFormatName {
 	/// Expect string as output, and write them directly
 	String,
modifiedcrates/jrsonnet-cli/src/tla.rsdiffbeforeafterboth
--- a/crates/jrsonnet-cli/src/tla.rs
+++ b/crates/jrsonnet-cli/src/tla.rs
@@ -1,7 +1,8 @@
-use crate::{ConfigureState, ExtFile, ExtStr};
 use clap::Parser;
 use jrsonnet_evaluator::{error::Result, EvaluationState};
 
+use crate::{ConfigureState, ExtFile, ExtStr};
+
 #[derive(Parser)]
 #[clap(next_help_heading = "TOP LEVEL ARGUMENTS")]
 pub struct TLAOpts {
modifiedcrates/jrsonnet-cli/src/trace.rsdiffbeforeafterboth
--- a/crates/jrsonnet-cli/src/trace.rs
+++ b/crates/jrsonnet-cli/src/trace.rs
@@ -1,12 +1,14 @@
-use crate::ConfigureState;
+use std::str::FromStr;
+
 use clap::Parser;
 use jrsonnet_evaluator::{
 	error::Result,
 	trace::{CompactFormat, ExplainingFormat, PathResolver},
 	EvaluationState,
 };
-use std::str::FromStr;
 
+use crate::ConfigureState;
+
 #[derive(PartialEq)]
 pub enum TraceFormatName {
 	Compact,
modifiedcrates/jrsonnet-evaluator/build.rsdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/build.rs
+++ b/crates/jrsonnet-evaluator/build.rs
@@ -1,6 +1,3 @@
-use bincode::serialize;
-use jrsonnet_parser::{parse, ParserSettings};
-use jrsonnet_stdlib::STDLIB_STR;
 use std::{
 	env,
 	fs::File,
@@ -8,6 +5,10 @@
 	path::{Path, PathBuf},
 };
 
+use bincode::serialize;
+use jrsonnet_parser::{parse, ParserSettings};
+use jrsonnet_stdlib::STDLIB_STR;
+
 fn main() {
 	let parsed = parse(
 		STDLIB_STR,
modifiedcrates/jrsonnet-evaluator/src/builtin/format.rsdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/builtin/format.rs
+++ b/crates/jrsonnet-evaluator/src/builtin/format.rs
@@ -1,13 +1,15 @@
 //! faster std.format impl
 #![allow(clippy::too_many_arguments)]
 
-use crate::{error::Error::*, throw, LocError, ObjValue, Result, Val};
+use std::convert::TryFrom;
+
 use gcmodule::Trace;
 use jrsonnet_interner::IStr;
 use jrsonnet_types::ValType;
-use std::convert::TryFrom;
 use thiserror::Error;
 
+use crate::{error::Error::*, throw, LocError, ObjValue, Result, Val};
+
 #[derive(Debug, Clone, Error, Trace)]
 pub enum FormatError {
 	#[error("truncated format code")]
modifiedcrates/jrsonnet-evaluator/src/builtin/manifest.rsdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/builtin/manifest.rs
+++ b/crates/jrsonnet-evaluator/src/builtin/manifest.rs
@@ -1,7 +1,7 @@
-use crate::error::Error::*;
-use crate::error::Result;
-use crate::push_description_frame;
-use crate::{throw, Val};
+use crate::{
+	error::{Error::*, Result},
+	push_description_frame, throw, Val,
+};
 
 #[derive(PartialEq, Clone, Copy)]
 pub enum ManifestType {
modifiedcrates/jrsonnet-evaluator/src/builtin/mod.rsdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/builtin/mod.rs
+++ b/crates/jrsonnet-evaluator/src/builtin/mod.rs
@@ -1,23 +1,25 @@
-use crate::function::{CallLocation, StaticBuiltin};
-use crate::typed::{Any, Bytes, PositiveF64, VecVal, M1};
-use crate::{
-	builtin::manifest::{manifest_yaml_ex, ManifestYamlOptions},
-	equals,
-	error::{Error::*, Result},
-	operator::evaluate_mod_op,
-	primitive_equals, push_frame, throw,
-	typed::{Either2, Either4},
-	with_state, ArrValue, FuncVal, IndexableVal, Val,
+use std::{
+	collections::HashMap,
+	convert::{TryFrom, TryInto},
 };
-use crate::{Either, ObjValue};
+
 use format::{format_arr, format_obj};
 use gcmodule::Cc;
 use jrsonnet_interner::IStr;
 use serde::Deserialize;
 use serde_yaml::DeserializingQuirks;
-use std::collections::HashMap;
-use std::convert::{TryFrom, TryInto};
 
+use crate::{
+	builtin::manifest::{manifest_yaml_ex, ManifestYamlOptions},
+	error::{Error::*, Result},
+	function::{CallLocation, StaticBuiltin},
+	operator::evaluate_mod_op,
+	push_frame, throw,
+	typed::{Any, BoundedUsize, Bytes, Either2, Either4, PositiveF64, VecVal, M1},
+	val::{equals, primitive_equals, ArrValue, FuncVal, IndexableVal, Slice},
+	with_state, Either, ObjValue, Val,
+};
+
 pub mod stdlib;
 pub use stdlib::*;
 
@@ -58,12 +60,12 @@
 			}
 
 			Ok(Val::Str(
-			(s.chars()
-				.skip(index)
-				.take(end - index)
-				.step_by(step)
-				.collect::<String>())
-			.into(),
+				(s.chars()
+					.skip(index)
+					.take(end - index)
+					.step_by(step)
+					.collect::<String>())
+				.into(),
 			))
 		}
 		IndexableVal::Arr(arr) => {
modifiedcrates/jrsonnet-evaluator/src/builtin/sort.rsdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/builtin/sort.rs
+++ b/crates/jrsonnet-evaluator/src/builtin/sort.rs
@@ -1,10 +1,12 @@
+use gcmodule::{Cc, Trace};
+
 use crate::{
 	error::{Error, LocError, Result},
 	throw,
 	typed::Any,
-	FuncVal, Val,
+	val::FuncVal,
+	Val,
 };
-use gcmodule::{Cc, Trace};
 
 #[derive(Debug, Clone, thiserror::Error, Trace)]
 pub enum SortError {
modifiedcrates/jrsonnet-evaluator/src/builtin/stdlib.rsdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/builtin/stdlib.rs
+++ b/crates/jrsonnet-evaluator/src/builtin/stdlib.rs
@@ -1,6 +1,7 @@
-use jrsonnet_parser::{LocExpr, ParserSettings};
 use std::path::PathBuf;
 
+use jrsonnet_parser::{LocExpr, ParserSettings};
+
 thread_local! {
 	/// To avoid parsing again when issued from the same thread
 	#[allow(unreachable_code)]
modifiedcrates/jrsonnet-evaluator/src/ctx.rsdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/ctx.rs
+++ b/crates/jrsonnet-evaluator/src/ctx.rs
@@ -1,12 +1,12 @@
-use crate::cc_ptr_eq;
-use crate::gc::GcHashMap;
+use std::fmt::Debug;
+
+use gcmodule::{Cc, Trace};
+use jrsonnet_interner::IStr;
+
 use crate::{
-	error::Error::*, map::LayeredHashMap, FutureWrapper, LazyBinding, LazyVal, ObjValue, Result,
-	Val,
+	cc_ptr_eq, error::Error::*, gc::GcHashMap, map::LayeredHashMap, FutureWrapper, LazyBinding,
+	LazyVal, ObjValue, Result, Val,
 };
-use gcmodule::{Cc, Trace};
-use jrsonnet_interner::IStr;
-use std::fmt::Debug;
 
 #[derive(Clone, Trace)]
 pub struct ContextCreator(pub Context, pub FutureWrapper<GcHashMap<IStr, LazyBinding>>);
modifiedcrates/jrsonnet-evaluator/src/error.rsdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/error.rs
+++ b/crates/jrsonnet-evaluator/src/error.rs
@@ -1,16 +1,18 @@
-use crate::{
-	builtin::{format::FormatError, sort::SortError},
-	typed::TypeLocError,
+use std::{
+	path::{Path, PathBuf},
+	rc::Rc,
 };
+
 use gcmodule::Trace;
 use jrsonnet_interner::IStr;
 use jrsonnet_parser::{BinaryOpType, ExprLocation, UnaryOpType};
 use jrsonnet_types::ValType;
-use std::{
-	path::{Path, PathBuf},
-	rc::Rc,
+use thiserror::Error;
+
+use crate::{
+	builtin::{format::FormatError, sort::SortError},
+	typed::TypeLocError,
 };
-use thiserror::Error;
 
 #[derive(Error, Debug, Clone, Trace)]
 pub enum Error {
modifiedcrates/jrsonnet-evaluator/src/evaluate/mod.rsdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/evaluate/mod.rs
+++ b/crates/jrsonnet-evaluator/src/evaluate/mod.rs
@@ -1,15 +1,5 @@
 use std::convert::TryFrom;
 
-use crate::{
-	builtin::{std_slice, BUILTINS},
-	error::Error::*,
-	evaluate::operator::{evaluate_add_op, evaluate_binary_op_special, evaluate_unary_op},
-	function::CallLocation,
-	gc::TraceBox,
-	push_frame, throw, with_state, ArrValue, Bindable, Context, ContextCreator, FuncDesc, FuncVal,
-	FutureWrapper, GcHashMap, LazyBinding, LazyVal, LazyValValue, ObjValue, ObjValueBuilder,
-	ObjectAssertion, Result, Val,
-};
 use gcmodule::{Cc, Trace};
 use jrsonnet_interner::IStr;
 use jrsonnet_parser::{
@@ -17,6 +7,19 @@
 	LiteralType, LocExpr, Member, ObjBody, ParamsDesc,
 };
 use jrsonnet_types::ValType;
+
+use crate::{
+	builtin::{std_slice, BUILTINS},
+	error::Error::*,
+	evaluate::operator::{evaluate_add_op, evaluate_binary_op_special, evaluate_unary_op},
+	function::CallLocation,
+	gc::TraceBox,
+	push_frame, throw,
+	typed::BoundedUsize,
+	val::{ArrValue, FuncDesc, FuncVal, LazyValValue},
+	with_state, Bindable, Context, ContextCreator, FutureWrapper, GcHashMap, LazyBinding, LazyVal,
+	ObjValue, ObjValueBuilder, ObjectAssertion, Result, Val,
+};
 pub mod operator;
 
 pub fn evaluate_binding_in_future(
modifiedcrates/jrsonnet-evaluator/src/evaluate/operator.rsdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/evaluate/operator.rs
+++ b/crates/jrsonnet-evaluator/src/evaluate/operator.rs
@@ -1,10 +1,11 @@
 use std::convert::TryInto;
 
-use crate::builtin::std_format;
-use crate::{equals, evaluate, Context, Val};
-use crate::{error::Error::*, throw, Result};
 use jrsonnet_parser::{BinaryOpType, LocExpr, UnaryOpType};
 
+use crate::{
+	builtin::std_format, error::Error::*, evaluate, throw, val::equals, Context, Result, Val,
+};
+
 pub fn evaluate_unary_op(op: UnaryOpType, b: &Val) -> Result<Val> {
 	use UnaryOpType::*;
 	use Val::*;
modifiedcrates/jrsonnet-evaluator/src/function.rsdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/function.rs
+++ b/crates/jrsonnet-evaluator/src/function.rs
@@ -1,16 +1,19 @@
+use std::{borrow::Cow, collections::HashMap, convert::TryFrom};
+
+use gcmodule::Trace;
+use jrsonnet_interner::IStr;
+pub use jrsonnet_macros::builtin;
+use jrsonnet_parser::{ArgsDesc, ExprLocation, LocExpr, ParamsDesc};
+
 use crate::{
 	error::{Error::*, LocError},
 	evaluate, evaluate_named,
 	gc::TraceBox,
 	throw,
 	typed::Typed,
-	Context, FutureWrapper, GcHashMap, LazyVal, LazyValValue, Result, Val,
+	val::LazyValValue,
+	Context, FutureWrapper, GcHashMap, LazyVal, Result, Val,
 };
-use gcmodule::Trace;
-use jrsonnet_interner::IStr;
-pub use jrsonnet_macros::builtin;
-use jrsonnet_parser::{ArgsDesc, ExprLocation, LocExpr, ParamsDesc};
-use std::{borrow::Cow, collections::HashMap, convert::TryFrom};
 
 #[derive(Clone, Copy)]
 pub struct CallLocation<'l>(pub Option<&'l ExprLocation>);
modifiedcrates/jrsonnet-evaluator/src/import.rsdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/import.rs
+++ b/crates/jrsonnet-evaluator/src/import.rs
@@ -1,17 +1,20 @@
-use crate::{
-	error::{Error::*, Result},
-	throw,
-};
-use fs::File;
-use jrsonnet_interner::IStr;
-use std::fs;
 use std::{
 	any::Any,
+	convert::TryFrom,
+	fs,
+	io::Read,
 	path::{Path, PathBuf},
 	rc::Rc,
 };
-use std::{convert::TryFrom, io::Read};
 
+use fs::File;
+use jrsonnet_interner::IStr;
+
+use crate::{
+	error::{Error::*, Result},
+	throw,
+};
+
 /// Implements file resolution logic for `import` and `importStr`
 pub trait ImportResolver {
 	/// Resolves real file path, e.g. `(/home/user/manifests, b.libjsonnet)` can correspond
modifiedcrates/jrsonnet-evaluator/src/integrations/serde.rsdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/integrations/serde.rs
+++ b/crates/jrsonnet-evaluator/src/integrations/serde.rs
@@ -1,9 +1,11 @@
+use std::convert::{TryFrom, TryInto};
+
+use serde_json::{Map, Number, Value};
+
 use crate::{
 	error::{Error::*, LocError, Result},
 	throw, ObjValueBuilder, Val,
 };
-use serde_json::{Map, Number, Value};
-use std::convert::{TryFrom, TryInto};
 
 impl TryFrom<&Val> for Value {
 	type Error = LocError;
modifiedcrates/jrsonnet-evaluator/src/lib.rsdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/lib.rs
+++ b/crates/jrsonnet-evaluator/src/lib.rs
@@ -13,6 +13,7 @@
 pub mod error;
 mod evaluate;
 pub mod function;
+pub mod gc;
 mod import;
 mod integrations;
 mod map;
@@ -20,9 +21,15 @@
 mod obj;
 pub mod trace;
 pub mod typed;
-mod val;
+pub mod val;
 
-pub use jrsonnet_parser as parser;
+use std::{
+	cell::{Ref, RefCell, RefMut},
+	collections::HashMap,
+	fmt::Debug,
+	path::{Path, PathBuf},
+	rc::Rc,
+};
 
 pub use ctx::*;
 pub use dynamic::*;
@@ -33,18 +40,11 @@
 use gcmodule::{Cc, Trace, Weak};
 pub use import::*;
 pub use jrsonnet_interner::IStr;
+pub use jrsonnet_parser as parser;
 use jrsonnet_parser::*;
 pub use obj::*;
-use std::{
-	cell::{Ref, RefCell, RefMut},
-	collections::HashMap,
-	fmt::Debug,
-	path::{Path, PathBuf},
-	rc::Rc,
-};
 use trace::{location_to_offset, offset_to_location, CodeLocation, CompactFormat, TraceFormat};
-pub use val::*;
-pub mod gc;
+pub use val::{LazyVal, ManifestFormat, Val};
 
 pub trait Bindable: Trace + 'static {
 	fn bind(&self, this: Option<ObjValue>, super_obj: Option<ObjValue>) -> Result<LazyVal>;
@@ -693,18 +693,24 @@
 
 #[cfg(test)]
 pub mod tests {
-	use super::Val;
-	use crate::{
-		error::Error::*, function::BuiltinParam, gc::TraceBox, native::NativeCallbackHandler,
-		primitive_equals, EvaluationState,
-	};
-	use gcmodule::{Cc, Trace};
-	use jrsonnet_parser::*;
 	use std::{
 		path::{Path, PathBuf},
 		rc::Rc,
 	};
 
+	use gcmodule::{Cc, Trace};
+	use jrsonnet_parser::*;
+
+	use super::Val;
+	use crate::{
+		error::Error::*,
+		function::{BuiltinParam, CallLocation},
+		gc::TraceBox,
+		native::NativeCallbackHandler,
+		val::primitive_equals,
+		EvaluationState,
+	};
+
 	#[test]
 	#[should_panic]
 	fn eval_state_stacktrace() {
@@ -712,11 +718,15 @@
 		state.run_in_state(|| {
 			state
 				.push(
-					Some(&ExprLocation(PathBuf::from("test1.jsonnet").into(), 10, 20)),
+					CallLocation::new(&ExprLocation(PathBuf::from("test1.jsonnet").into(), 10, 20)),
 					|| "outer".to_owned(),
 					|| {
 						state.push(
-							Some(&ExprLocation(PathBuf::from("test2.jsonnet").into(), 30, 40)),
+							CallLocation::new(&ExprLocation(
+								PathBuf::from("test2.jsonnet").into(),
+								30,
+								40,
+							)),
 							|| "inner".to_owned(),
 							|| Err(RuntimeError("".into()).into()),
 						)?;
@@ -1290,10 +1300,11 @@
 	}
 
 	mod derive_typed {
+		use std::path::PathBuf;
+
 		use crate::{typed::Typed, EvaluationState};
-		use std::path::PathBuf;
 
-		#[derive(Typed, PartialEq, Debug)]
+		#[derive(PartialEq, Debug, Typed)]
 		struct MyTyped {
 			a: u32,
 			#[typed(rename = "b")]
modifiedcrates/jrsonnet-evaluator/src/native.rsdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/native.rs
+++ b/crates/jrsonnet-evaluator/src/native.rs
@@ -1,13 +1,16 @@
 #![allow(clippy::type_complexity)]
 
-use crate::function::{parse_builtin_call, ArgsLike, Builtin, BuiltinParam, CallLocation};
-use crate::gc::TraceBox;
-use crate::Context;
-use crate::{error::Result, Val};
+use std::{path::Path, rc::Rc};
+
 use gcmodule::Trace;
-use std::path::Path;
-use std::rc::Rc;
 
+use crate::{
+	error::Result,
+	function::{parse_builtin_call, ArgsLike, Builtin, BuiltinParam, CallLocation},
+	gc::TraceBox,
+	Context, Val,
+};
+
 #[derive(Trace)]
 pub struct NativeCallback {
 	pub(crate) params: Vec<BuiltinParam>,
modifiedcrates/jrsonnet-evaluator/src/obj.rsdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/obj.rs
+++ b/crates/jrsonnet-evaluator/src/obj.rs
@@ -1,20 +1,23 @@
-use crate::error::LocError;
-use crate::function::CallLocation;
-use crate::gc::{GcHashMap, GcHashSet, TraceBox};
-use crate::operator::evaluate_add_op;
-use crate::push_frame;
-use crate::{
-	cc_ptr_eq, error::Error::*, throw, weak_ptr_eq, weak_raw, Bindable, LazyBinding, LazyVal,
-	Result, Val,
+use std::{
+	cell::RefCell,
+	fmt::Debug,
+	hash::{Hash, Hasher},
 };
+
 use gcmodule::{Cc, Trace, Weak};
 use jrsonnet_interner::IStr;
 use jrsonnet_parser::{ExprLocation, Visibility};
 use rustc_hash::FxHashMap;
-use std::cell::RefCell;
-use std::fmt::Debug;
-use std::hash::{Hash, Hasher};
 
+use crate::{
+	cc_ptr_eq,
+	error::{Error::*, LocError},
+	function::CallLocation,
+	gc::{GcHashMap, GcHashSet, TraceBox},
+	operator::evaluate_add_op,
+	push_frame, throw, weak_ptr_eq, weak_raw, Bindable, LazyBinding, LazyVal, Result, Val,
+};
+
 #[derive(Debug, Trace)]
 pub struct ObjMember {
 	pub add: bool,
modifiedcrates/jrsonnet-evaluator/src/trace/mod.rsdiffbeforeafterboth
before · crates/jrsonnet-evaluator/src/trace/mod.rs
1mod location;23use crate::{error::Error, EvaluationState, LocError};4pub use location::*;5use std::path::{Path, PathBuf};67/// The way paths should be displayed8pub enum PathResolver {9	/// Only filename10	FileName,11	/// Absolute path12	Absolute,13	/// Path relative to base directory14	Relative(PathBuf),15}1617impl PathResolver {18	pub fn resolve(&self, from: &Path) -> String {19		match self {20			Self::FileName => from.file_name().unwrap().to_string_lossy().into_owned(),21			Self::Absolute => from.to_string_lossy().into_owned(),22			Self::Relative(base) => {23				if from.is_relative() {24					return from.to_string_lossy().into_owned();25				}26				pathdiff::diff_paths(from, base)27					.unwrap()28					.to_string_lossy()29					.into_owned()30			}31		}32	}33}3435/// Implements pretty-printing of traces36pub trait TraceFormat {37	fn write_trace(38		&self,39		out: &mut dyn std::fmt::Write,40		evaluation_state: &EvaluationState,41		error: &LocError,42	) -> Result<(), std::fmt::Error>;43	// fn print_trace(44	// 	&self,45	// 	evaluation_state: &EvaluationState,46	// 	error: &LocError,47	// ) -> Result<(), std::fmt::Error> {48	// 	self.write_trace(&mut std::fmt::stdout(), evaluation_state, error)49	// }50}5152fn print_code_location(53	out: &mut impl std::fmt::Write,54	start: &CodeLocation,55	end: &CodeLocation,56) -> Result<(), std::fmt::Error> {57	if start.line == end.line {58		if start.column == end.column {59			write!(out, "{}:{}", start.line, end.column - 1)?;60		} else {61			write!(out, "{}:{}-{}", start.line, start.column - 1, end.column)?;62		}63	} else {64		write!(65			out,66			"{}:{}-{}:{}",67			start.line,68			end.column.saturating_sub(1),69			start.line,70			end.column71		)?;72	}73	Ok(())74}7576/// vanilla-like jsonnet formatting77pub struct CompactFormat {78	pub resolver: PathResolver,79	pub padding: usize,80}8182impl TraceFormat for CompactFormat {83	fn write_trace(84		&self,85		out: &mut dyn std::fmt::Write,86		evaluation_state: &EvaluationState,87		error: &LocError,88	) -> Result<(), std::fmt::Error> {89		write!(out, "{}", error.error())?;90		if let Error::ImportSyntaxError {91			path,92			source_code,93			error,94		} = error.error()95		{96			writeln!(out)?;97			use std::fmt::Write;98			let mut n = self.resolver.resolve(path);99			let mut offset = error.location.offset;100			let is_eof = if offset >= source_code.len() {101				offset = source_code.len().saturating_sub(1);102				true103			} else {104				false105			};106			let mut location = offset_to_location(source_code, &[offset])107				.into_iter()108				.next()109				.unwrap();110			if is_eof {111				location.column += 1;112			}113114			write!(n, ":").unwrap();115			print_code_location(&mut n, &location, &location).unwrap();116			write!(out, "{:<p$}{}", "", n, p = self.padding,)?;117		}118		let file_names = error119			.trace()120			.0121			.iter()122			.map(|el| &el.location)123			.map(|location| {124				use std::fmt::Write;125				#[allow(clippy::option_if_let_else)]126				if let Some(location) = location {127					let mut resolved_path = self.resolver.resolve(&location.0);128					// TODO: Process all trace elements first129					let location = evaluation_state130						.map_source_locations(&location.0, &[location.1, location.2]);131					write!(resolved_path, ":").unwrap();132					print_code_location(&mut resolved_path, &location[0], &location[1]).unwrap();133					write!(resolved_path, ":").unwrap();134					Some(resolved_path)135				} else {136					None137				}138			})139			.collect::<Vec<_>>();140		let align = file_names141			.iter()142			.flatten()143			.map(|e| e.len())144			.max()145			.unwrap_or(0);146		for (el, file) in error.trace().0.iter().zip(file_names) {147			writeln!(out)?;148			if let Some(file) = file {149				write!(150					out,151					"{:<p$}{:<w$} {}",152					"",153					file,154					el.desc,155					p = self.padding,156					w = align157				)?;158			} else {159				write!(out, "{:<p$}{}", "", el.desc, p = self.padding,)?;160			}161		}162		Ok(())163	}164}165166pub struct JsFormat;167impl TraceFormat for JsFormat {168	fn write_trace(169		&self,170		out: &mut dyn std::fmt::Write,171		evaluation_state: &EvaluationState,172		error: &LocError,173	) -> Result<(), std::fmt::Error> {174		write!(out, "{}", error.error())?;175		for item in error.trace().0.iter() {176			writeln!(out)?;177			let desc = &item.desc;178			if let Some(source) = &item.location {179				let start_end =180					evaluation_state.map_source_locations(&source.0, &[source.1, source.2]);181182				write!(183					out,184					"    at {} ({}:{}:{})",185					desc,186					source.0.to_str().unwrap(),187					start_end[0].line,188					start_end[0].column,189				)?;190			} else {191				write!(out, "    during {}", desc)?;192			}193		}194		Ok(())195	}196}197198/// rustc-like trace displaying199#[cfg(feature = "explaining-traces")]200pub struct ExplainingFormat {201	pub resolver: PathResolver,202}203#[cfg(feature = "explaining-traces")]204impl TraceFormat for ExplainingFormat {205	fn write_trace(206		&self,207		out: &mut dyn std::fmt::Write,208		evaluation_state: &EvaluationState,209		error: &LocError,210	) -> Result<(), std::fmt::Error> {211		write!(out, "{}", error.error())?;212		if let Error::ImportSyntaxError {213			path,214			source_code,215			error,216		} = error.error()217		{218			writeln!(out)?;219			let offset = error.location.offset;220			let location = offset_to_location(source_code, &[offset])221				.into_iter()222				.next()223				.unwrap();224			let mut end_location = location.clone();225			end_location.offset += 1;226227			self.print_snippet(228				out,229				source_code,230				path,231				&location,232				&end_location,233				"syntax error",234			)?;235		}236		let trace = &error.trace();237		for item in trace.0.iter() {238			writeln!(out)?;239			let desc = &item.desc;240			if let Some(source) = &item.location {241				let start_end =242					evaluation_state.map_source_locations(&source.0, &[source.1, source.2]);243				self.print_snippet(244					out,245					&evaluation_state.get_source(&source.0).unwrap(),246					&source.0,247					&start_end[0],248					&start_end[1],249					desc,250				)?;251			} else {252				write!(out, "{}", desc)?;253			}254		}255		Ok(())256	}257}258259impl ExplainingFormat {260	fn print_snippet(261		&self,262		out: &mut dyn std::fmt::Write,263		source: &str,264		origin: &Path,265		start: &CodeLocation,266		end: &CodeLocation,267		desc: &str,268	) -> Result<(), std::fmt::Error> {269		use annotate_snippets::{270			display_list::{DisplayList, FormatOptions},271			snippet::{AnnotationType, Slice, Snippet, SourceAnnotation},272		};273274		let source_fragment: String = source275			.chars()276			.skip(start.line_start_offset)277			.take(end.line_end_offset - end.line_start_offset)278			.collect();279280		let origin = self.resolver.resolve(origin);281		let snippet = Snippet {282			opt: FormatOptions {283				color: true,284				..Default::default()285			},286			title: None,287			footer: vec![],288			slices: vec![Slice {289				source: &source_fragment,290				line_start: start.line,291				origin: Some(&origin),292				fold: false,293				annotations: vec![SourceAnnotation {294					label: desc,295					annotation_type: AnnotationType::Error,296					range: (297						start.offset - start.line_start_offset,298						(end.offset - start.line_start_offset).min(source_fragment.len()),299					),300				}],301			}],302		};303304		let dl = DisplayList::from(snippet);305		write!(out, "{}", dl)?;306307		Ok(())308	}309}
after · crates/jrsonnet-evaluator/src/trace/mod.rs
1mod location;23use std::path::{Path, PathBuf};45pub use location::*;67use crate::{error::Error, EvaluationState, LocError};89/// The way paths should be displayed10pub enum PathResolver {11	/// Only filename12	FileName,13	/// Absolute path14	Absolute,15	/// Path relative to base directory16	Relative(PathBuf),17}1819impl PathResolver {20	pub fn resolve(&self, from: &Path) -> String {21		match self {22			Self::FileName => from.file_name().unwrap().to_string_lossy().into_owned(),23			Self::Absolute => from.to_string_lossy().into_owned(),24			Self::Relative(base) => {25				if from.is_relative() {26					return from.to_string_lossy().into_owned();27				}28				pathdiff::diff_paths(from, base)29					.unwrap()30					.to_string_lossy()31					.into_owned()32			}33		}34	}35}3637/// Implements pretty-printing of traces38pub trait TraceFormat {39	fn write_trace(40		&self,41		out: &mut dyn std::fmt::Write,42		evaluation_state: &EvaluationState,43		error: &LocError,44	) -> Result<(), std::fmt::Error>;45	// fn print_trace(46	// 	&self,47	// 	evaluation_state: &EvaluationState,48	// 	error: &LocError,49	// ) -> Result<(), std::fmt::Error> {50	// 	self.write_trace(&mut std::fmt::stdout(), evaluation_state, error)51	// }52}5354fn print_code_location(55	out: &mut impl std::fmt::Write,56	start: &CodeLocation,57	end: &CodeLocation,58) -> Result<(), std::fmt::Error> {59	if start.line == end.line {60		if start.column == end.column {61			write!(out, "{}:{}", start.line, end.column - 1)?;62		} else {63			write!(out, "{}:{}-{}", start.line, start.column - 1, end.column)?;64		}65	} else {66		write!(67			out,68			"{}:{}-{}:{}",69			start.line,70			end.column.saturating_sub(1),71			start.line,72			end.column73		)?;74	}75	Ok(())76}7778/// vanilla-like jsonnet formatting79pub struct CompactFormat {80	pub resolver: PathResolver,81	pub padding: usize,82}8384impl TraceFormat for CompactFormat {85	fn write_trace(86		&self,87		out: &mut dyn std::fmt::Write,88		evaluation_state: &EvaluationState,89		error: &LocError,90	) -> Result<(), std::fmt::Error> {91		write!(out, "{}", error.error())?;92		if let Error::ImportSyntaxError {93			path,94			source_code,95			error,96		} = error.error()97		{98			writeln!(out)?;99			use std::fmt::Write;100			let mut n = self.resolver.resolve(path);101			let mut offset = error.location.offset;102			let is_eof = if offset >= source_code.len() {103				offset = source_code.len().saturating_sub(1);104				true105			} else {106				false107			};108			let mut location = offset_to_location(source_code, &[offset])109				.into_iter()110				.next()111				.unwrap();112			if is_eof {113				location.column += 1;114			}115116			write!(n, ":").unwrap();117			print_code_location(&mut n, &location, &location).unwrap();118			write!(out, "{:<p$}{}", "", n, p = self.padding,)?;119		}120		let file_names = error121			.trace()122			.0123			.iter()124			.map(|el| &el.location)125			.map(|location| {126				use std::fmt::Write;127				#[allow(clippy::option_if_let_else)]128				if let Some(location) = location {129					let mut resolved_path = self.resolver.resolve(&location.0);130					// TODO: Process all trace elements first131					let location = evaluation_state132						.map_source_locations(&location.0, &[location.1, location.2]);133					write!(resolved_path, ":").unwrap();134					print_code_location(&mut resolved_path, &location[0], &location[1]).unwrap();135					write!(resolved_path, ":").unwrap();136					Some(resolved_path)137				} else {138					None139				}140			})141			.collect::<Vec<_>>();142		let align = file_names143			.iter()144			.flatten()145			.map(|e| e.len())146			.max()147			.unwrap_or(0);148		for (el, file) in error.trace().0.iter().zip(file_names) {149			writeln!(out)?;150			if let Some(file) = file {151				write!(152					out,153					"{:<p$}{:<w$} {}",154					"",155					file,156					el.desc,157					p = self.padding,158					w = align159				)?;160			} else {161				write!(out, "{:<p$}{}", "", el.desc, p = self.padding,)?;162			}163		}164		Ok(())165	}166}167168pub struct JsFormat;169impl TraceFormat for JsFormat {170	fn write_trace(171		&self,172		out: &mut dyn std::fmt::Write,173		evaluation_state: &EvaluationState,174		error: &LocError,175	) -> Result<(), std::fmt::Error> {176		write!(out, "{}", error.error())?;177		for item in error.trace().0.iter() {178			writeln!(out)?;179			let desc = &item.desc;180			if let Some(source) = &item.location {181				let start_end =182					evaluation_state.map_source_locations(&source.0, &[source.1, source.2]);183184				write!(185					out,186					"    at {} ({}:{}:{})",187					desc,188					source.0.to_str().unwrap(),189					start_end[0].line,190					start_end[0].column,191				)?;192			} else {193				write!(out, "    during {}", desc)?;194			}195		}196		Ok(())197	}198}199200/// rustc-like trace displaying201#[cfg(feature = "explaining-traces")]202pub struct ExplainingFormat {203	pub resolver: PathResolver,204}205#[cfg(feature = "explaining-traces")]206impl TraceFormat for ExplainingFormat {207	fn write_trace(208		&self,209		out: &mut dyn std::fmt::Write,210		evaluation_state: &EvaluationState,211		error: &LocError,212	) -> Result<(), std::fmt::Error> {213		write!(out, "{}", error.error())?;214		if let Error::ImportSyntaxError {215			path,216			source_code,217			error,218		} = error.error()219		{220			writeln!(out)?;221			let offset = error.location.offset;222			let location = offset_to_location(source_code, &[offset])223				.into_iter()224				.next()225				.unwrap();226			let mut end_location = location.clone();227			end_location.offset += 1;228229			self.print_snippet(230				out,231				source_code,232				path,233				&location,234				&end_location,235				"syntax error",236			)?;237		}238		let trace = &error.trace();239		for item in trace.0.iter() {240			writeln!(out)?;241			let desc = &item.desc;242			if let Some(source) = &item.location {243				let start_end =244					evaluation_state.map_source_locations(&source.0, &[source.1, source.2]);245				self.print_snippet(246					out,247					&evaluation_state.get_source(&source.0).unwrap(),248					&source.0,249					&start_end[0],250					&start_end[1],251					desc,252				)?;253			} else {254				write!(out, "{}", desc)?;255			}256		}257		Ok(())258	}259}260261impl ExplainingFormat {262	fn print_snippet(263		&self,264		out: &mut dyn std::fmt::Write,265		source: &str,266		origin: &Path,267		start: &CodeLocation,268		end: &CodeLocation,269		desc: &str,270	) -> Result<(), std::fmt::Error> {271		use annotate_snippets::{272			display_list::{DisplayList, FormatOptions},273			snippet::{AnnotationType, Slice, Snippet, SourceAnnotation},274		};275276		let source_fragment: String = source277			.chars()278			.skip(start.line_start_offset)279			.take(end.line_end_offset - end.line_start_offset)280			.collect();281282		let origin = self.resolver.resolve(origin);283		let snippet = Snippet {284			opt: FormatOptions {285				color: true,286				..Default::default()287			},288			title: None,289			footer: vec![],290			slices: vec![Slice {291				source: &source_fragment,292				line_start: start.line,293				origin: Some(&origin),294				fold: false,295				annotations: vec![SourceAnnotation {296					label: desc,297					annotation_type: AnnotationType::Error,298					range: (299						start.offset - start.line_start_offset,300						(end.offset - start.line_start_offset).min(source_fragment.len()),301					),302				}],303			}],304		};305306		let dl = DisplayList::from(snippet);307		write!(out, "{}", dl)?;308309		Ok(())310	}311}
modifiedcrates/jrsonnet-evaluator/src/typed/mod.rsdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/typed/mod.rs
+++ b/crates/jrsonnet-evaluator/src/typed/mod.rs
@@ -2,14 +2,14 @@
 
 mod conversions;
 pub use conversions::*;
+use gcmodule::Trace;
+pub use jrsonnet_types::{ComplexValType, ValType};
+use thiserror::Error;
 
 use crate::{
 	error::{Error, LocError, Result},
 	push_description_frame, Val,
 };
-use gcmodule::Trace;
-pub use jrsonnet_types::{ComplexValType, ValType};
-use thiserror::Error;
 
 #[derive(Debug, Error, Clone, Trace)]
 pub enum TypeError {
modifiedcrates/jrsonnet-evaluator/src/val.rsdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/val.rs
+++ b/crates/jrsonnet-evaluator/src/val.rs
@@ -1,3 +1,10 @@
+use std::{cell::RefCell, fmt::Debug, rc::Rc};
+
+use gcmodule::{Cc, Trace};
+use jrsonnet_interner::IStr;
+use jrsonnet_parser::{LocExpr, ParamsDesc};
+use jrsonnet_types::ValType;
+
 use crate::{
 	builtin::manifest::{
 		manifest_json_ex, manifest_yaml_ex, ManifestJsonOptions, ManifestType, ManifestYamlOptions,
@@ -12,11 +19,6 @@
 	gc::TraceBox,
 	throw, Context, ObjValue, Result,
 };
-use gcmodule::{Cc, Trace};
-use jrsonnet_interner::IStr;
-use jrsonnet_parser::{LocExpr, ParamsDesc};
-use jrsonnet_types::ValType;
-use std::{cell::RefCell, fmt::Debug, rc::Rc};
 
 pub trait LazyValValue: Trace {
 	fn get(self: Box<Self>) -> Result<Val>;
modifiedcrates/jrsonnet-interner/src/lib.rsdiffbeforeafterboth
--- a/crates/jrsonnet-interner/src/lib.rs
+++ b/crates/jrsonnet-interner/src/lib.rs
@@ -1,6 +1,3 @@
-use gcmodule::Trace;
-use rustc_hash::FxHashMap;
-use serde::{Deserialize, Serialize};
 use std::{
 	borrow::Cow,
 	cell::RefCell,
@@ -12,6 +9,10 @@
 	str::Utf8Error,
 };
 
+use gcmodule::Trace;
+use rustc_hash::FxHashMap;
+use serde::{Deserialize, Serialize};
+
 #[derive(Clone, PartialOrd, Ord, Eq)]
 pub struct IStr(Rc<str>);
 impl Trace for IStr {
modifiedcrates/jrsonnet-parser/src/expr.rsdiffbeforeafterboth
--- a/crates/jrsonnet-parser/src/expr.rs
+++ b/crates/jrsonnet-parser/src/expr.rs
@@ -1,7 +1,3 @@
-use gcmodule::Trace;
-use jrsonnet_interner::IStr;
-#[cfg(feature = "serde")]
-use serde::{Deserialize, Serialize};
 use std::{
 	fmt::{Debug, Display},
 	ops::Deref,
@@ -9,6 +5,11 @@
 	rc::Rc,
 };
 
+use gcmodule::Trace;
+use jrsonnet_interner::IStr;
+#[cfg(feature = "serde")]
+use serde::{Deserialize, Serialize};
+
 #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
 #[derive(Debug, PartialEq, Trace)]
 pub enum FieldName {
modifiedcrates/jrsonnet-parser/src/lib.rsdiffbeforeafterboth
--- a/crates/jrsonnet-parser/src/lib.rs
+++ b/crates/jrsonnet-parser/src/lib.rs
@@ -1,10 +1,11 @@
 #![allow(clippy::redundant_closure_call)]
 
-use peg::parser;
 use std::{
 	path::{Path, PathBuf},
 	rc::Rc,
 };
+
+use peg::parser;
 mod expr;
 pub use expr::*;
 pub use jrsonnet_interner::IStr;
@@ -317,11 +318,13 @@
 
 #[cfg(test)]
 pub mod tests {
-	use super::{expr::*, parse};
-	use crate::ParserSettings;
 	use std::path::PathBuf;
+
 	use BinaryOpType::*;
 
+	use super::{expr::*, parse};
+	use crate::ParserSettings;
+
 	macro_rules! parse {
 		($s:expr) => {
 			parse(
modifiedcrates/jrsonnet-types/src/lib.rsdiffbeforeafterboth
--- a/crates/jrsonnet-types/src/lib.rs
+++ b/crates/jrsonnet-types/src/lib.rs
@@ -1,8 +1,9 @@
 #![allow(clippy::redundant_closure_call)]
 
-use gcmodule::Trace;
 use std::fmt::Display;
 
+use gcmodule::Trace;
+
 #[macro_export]
 macro_rules! ty {
 	((Array<number>)) => {{