git.delta.rocks / jrsonnet / refs/commits / a05afd32cebc

difftreelog

style fix clippy warnings

Yaroslav Bolyukin2023-01-20parent: #974f2c1.patch.diff
in: master

16 files changed

modifiedcmds/jrsonnet/src/main.rsdiffbeforeafterboth
--- a/cmds/jrsonnet/src/main.rs
+++ b/cmds/jrsonnet/src/main.rs
@@ -5,7 +5,7 @@
 
 use clap::{CommandFactory, Parser};
 use clap_complete::Shell;
-use jrsonnet_cli::{ManifestOpts, OutputOpts, TraceOpts, MiscOpts, TlaOpts, StdOpts, GcOpts};
+use jrsonnet_cli::{GcOpts, ManifestOpts, MiscOpts, OutputOpts, StdOpts, TlaOpts, TraceOpts};
 use jrsonnet_evaluator::{
 	apply_tla,
 	error::{Error as JrError, ErrorKind},
@@ -133,16 +133,14 @@
 
 fn main_catch(opts: Opts) -> bool {
 	let s = State::default();
-	let trace = opts
-		.trace
-		.trace_format();
+	let trace = opts.trace.trace_format();
 	if let Err(e) = main_real(&s, opts) {
 		if let Error::Evaluation(e) = e {
 			let mut out = String::new();
 			trace.write_trace(&mut out, &e).expect("format error");
 			eprintln!("{out}")
 		} else {
-			eprintln!("{}", e);
+			eprintln!("{e}");
 		}
 		return false;
 	}
@@ -150,7 +148,7 @@
 }
 
 fn main_real(s: &State, opts: Opts) -> Result<(), Error> {
-	let _gc_leak_guard= opts.gc.leak_on_exit();
+	let _gc_leak_guard = opts.gc.leak_on_exit();
 	let _gc_print_stats = opts.gc.stats_printer();
 	let _stack_depth_override = opts.misc.stack_size_override();
 
@@ -220,7 +218,7 @@
 	} else {
 		let output = val.manifest(manifest_format)?;
 		if !output.is_empty() {
-			println!("{}", output);
+			println!("{output}");
 		}
 	}
 
modifiedcrates/jrsonnet-cli/src/lib.rsdiffbeforeafterboth
--- a/crates/jrsonnet-cli/src/lib.rs
+++ b/crates/jrsonnet-cli/src/lib.rs
@@ -6,7 +6,10 @@
 use std::{env, marker::PhantomData, path::PathBuf};
 
 use clap::Parser;
-use jrsonnet_evaluator::{error::Result, stack::{set_stack_depth_limit, StackDepthLimitOverrideGuard, limit_stack_depth}, FileImportResolver, State, ImportResolver};
+use jrsonnet_evaluator::{
+	stack::{limit_stack_depth, StackDepthLimitOverrideGuard},
+	FileImportResolver,
+};
 use jrsonnet_gcmodule::with_thread_object_space;
 pub use manifest::*;
 pub use stdlib::*;
@@ -71,6 +74,7 @@
 }
 impl GcOpts {
 	pub fn stats_printer(&self) -> Option<GcStatsPrinter> {
+		#[allow(clippy::unnecessary_lazy_evaluations/*, reason = "GcStatsPrinter has side-effect on Drop"*/)]
 		self.gc_print_stats.then(|| GcStatsPrinter {
 			collect_before_printing_stats: self.gc_collect_before_printing_stats,
 		})
@@ -96,7 +100,7 @@
 		eprintln!("=== GC STATS ===");
 		if self.collect_before_printing_stats {
 			let collected = jrsonnet_gcmodule::collect_thread_cycles();
-			eprintln!("Collected: {}", collected);
+			eprintln!("Collected: {collected}");
 		}
 		eprintln!("Tracked: {}", jrsonnet_gcmodule::count_thread_tracked())
 	}
modifiedcrates/jrsonnet-cli/src/manifest.rsdiffbeforeafterboth
--- a/crates/jrsonnet-cli/src/manifest.rs
+++ b/crates/jrsonnet-cli/src/manifest.rs
@@ -1,10 +1,8 @@
 use std::path::PathBuf;
 
 use clap::{Parser, ValueEnum};
-use jrsonnet_evaluator::{
-	error::Result,
-	manifest::{JsonFormat, ManifestFormat, StringFormat, ToStringFormat, YamlStreamFormat},
-	State,
+use jrsonnet_evaluator::manifest::{
+	JsonFormat, ManifestFormat, StringFormat, ToStringFormat, YamlStreamFormat,
 };
 use jrsonnet_stdlib::{TomlFormat, YamlFormat};
 
modifiedcrates/jrsonnet-cli/src/stdlib.rsdiffbeforeafterboth
--- a/crates/jrsonnet-cli/src/stdlib.rs
+++ b/crates/jrsonnet-cli/src/stdlib.rs
@@ -1,7 +1,7 @@
 use std::{fs::read_to_string, str::FromStr};
 
 use clap::Parser;
-use jrsonnet_evaluator::{error::Result, tb, trace::PathResolver, State};
+use jrsonnet_evaluator::{error::Result, trace::PathResolver, State};
 use jrsonnet_stdlib::ContextInitializer;
 
 #[derive(Clone)]
@@ -49,7 +49,7 @@
 				name: out[0].into(),
 				value: content,
 			}),
-			Err(e) => Err(format!("{}", e)),
+			Err(e) => Err(format!("{e}")),
 		}
 	}
 }
@@ -86,8 +86,7 @@
 		if self.no_stdlib {
 			return Ok(None);
 		}
-		let ctx =
-			ContextInitializer::new(s.clone(), PathResolver::new_cwd_fallback());
+		let ctx = ContextInitializer::new(s.clone(), PathResolver::new_cwd_fallback());
 		for ext in self.ext_str.iter() {
 			ctx.add_ext_str((&ext.name as &str).into(), (&ext.value as &str).into());
 		}
modifiedcrates/jrsonnet-cli/src/tla.rsdiffbeforeafterboth
--- a/crates/jrsonnet-cli/src/tla.rs
+++ b/crates/jrsonnet-cli/src/tla.rs
@@ -3,7 +3,7 @@
 	error::{ErrorKind, Result},
 	function::TlaArg,
 	gc::GcHashMap,
-	IStr, State,
+	IStr,
 };
 use jrsonnet_parser::{ParserSettings, Source};
 
modifiedcrates/jrsonnet-cli/src/trace.rsdiffbeforeafterboth
--- a/crates/jrsonnet-cli/src/trace.rs
+++ b/crates/jrsonnet-cli/src/trace.rs
@@ -1,9 +1,5 @@
 use clap::{Parser, ValueEnum};
-use jrsonnet_evaluator::{
-	error::Result,
-	trace::{CompactFormat, ExplainingFormat, PathResolver, TraceFormat},
-	State,
-};
+use jrsonnet_evaluator::trace::{CompactFormat, ExplainingFormat, PathResolver, TraceFormat};
 
 #[derive(PartialEq, Eq, ValueEnum, Clone)]
 pub enum TraceFormatName {
modifiedcrates/jrsonnet-evaluator/src/error.rsdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/error.rs
+++ b/crates/jrsonnet-evaluator/src/error.rs
@@ -274,6 +274,7 @@
 		f.debug_tuple("LocError").field(&self.0).finish()
 	}
 }
+impl std::error::Error for Error {}
 
 pub trait ErrorSource {
 	fn to_location(self) -> Option<ExprLocation>;
modifiedcrates/jrsonnet-evaluator/src/evaluate/operator.rsdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/evaluate/operator.rs
+++ b/crates/jrsonnet-evaluator/src/evaluate/operator.rs
@@ -104,28 +104,15 @@
 					}
 				}
 			} else {
-				{
-					let ai = a.iter();
-					let bi = b.iter();
+				let ai = a.iter();
+				let bi = b.iter();
 
-					for (a, b) in ai.zip(bi) {
-						let ord = evaluate_compare_op(&a?, &b?, op)?;
-						if !ord.is_eq() {
-							return Ok(ord);
-						}
+				for (a, b) in ai.zip(bi) {
+					let ord = evaluate_compare_op(&a?, &b?, op)?;
+					if !ord.is_eq() {
+						return Ok(ord);
 					}
 				}
-				// {
-				// 	let ai = a.iter_expl();
-				// 	let bi = b.iter_expl();
-
-				// 	for (a, b) in ai.zip(bi) {
-				// 		let ord = evaluate_compare_op(&a?, &b?, op)?;
-				// 		if !ord.is_eq() {
-				// 			return Ok(ord);
-				// 		}
-				// 	}
-				// }
 			}
 			a.len().cmp(&b.len())
 		}
modifiedcrates/jrsonnet-evaluator/src/lib.rsdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/lib.rs
+++ b/crates/jrsonnet-evaluator/src/lib.rs
@@ -36,6 +36,7 @@
 	clippy::use_self,
 	// https://github.com/rust-lang/rust-clippy/issues/8539
 	clippy::iter_with_drain,
+	clippy::type_repetition_in_bounds,
 	// ci is being run with nightly, but library should work on stable
 	clippy::missing_const_for_fn,
 )]
modifiedcrates/jrsonnet-evaluator/src/obj.rsdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/obj.rs
+++ b/crates/jrsonnet-evaluator/src/obj.rs
@@ -54,7 +54,7 @@
 
 #[cfg(feature = "exp-preserve-order")]
 mod ordering {
-	use std::cmp::Reverse;
+	use std::cmp::{Ordering, Reverse};
 
 	use jrsonnet_gcmodule::Trace;
 
@@ -81,12 +81,10 @@
 			Self(Reverse(depth), index)
 		}
 		pub fn collide(self, other: Self) -> Self {
-			if self.0 .0 > other.0 .0 {
-				self
-			} else if self.0 .0 < other.0 .0 {
-				other
-			} else {
-				unreachable!("object can't have two fields with same name")
+			match self.0 .0.cmp(&other.0 .0) {
+				Ordering::Greater => self,
+				Ordering::Less => other,
+				Ordering::Equal => unreachable!("object can't have two fields with the same name"),
 			}
 		}
 	}
@@ -188,6 +186,12 @@
 	pub fn new_empty() -> Self {
 		Self::new(None, Cc::new(GcHashMap::new()), Cc::new(Vec::new()))
 	}
+	pub fn builder() -> ObjValueBuilder {
+		ObjValueBuilder::new()
+	}
+	pub fn builder_with_capacity(capacity: usize) -> ObjValueBuilder {
+		ObjValueBuilder::with_capacity(capacity)
+	}
 	#[must_use]
 	pub fn extend_from(&self, sup: Self) -> Self {
 		match &self.0.sup {
@@ -304,7 +308,7 @@
 						break;
 					}
 					fields[j] = fields[k].clone();
-					j = k
+					j = k;
 				}
 				fields[j] = x;
 			}
modifiedcrates/jrsonnet-evaluator/src/val.rsdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/val.rs
+++ b/crates/jrsonnet-evaluator/src/val.rs
@@ -33,6 +33,7 @@
 	Pending,
 }
 
+/// Lazily evaluated value
 #[allow(clippy::module_name_repetitions)]
 #[derive(Clone, Trace)]
 pub struct Thunk<T: Trace>(Cc<RefCell<ThunkInner<T>>>);
@@ -57,6 +58,13 @@
 		self.evaluate()?;
 		Ok(())
 	}
+
+	/// Evaluate thunk, or return cached value
+	///
+	/// # Errors
+	///
+	/// - Lazy value evaluation returned error
+	/// - This method was called during inner value evaluation
 	pub fn evaluate(&self) -> Result<T> {
 		match &*self.0.borrow() {
 			ThunkInner::Computed(v) => return Ok(v.clone()),
@@ -132,7 +140,7 @@
 	}
 }
 
-/// Represents a Jsonnet value, which can be spliced or indexed (string or array).
+/// Represents a Jsonnet value, which can be sliced or indexed (string or array).
 #[allow(clippy::module_name_repetitions)]
 pub enum IndexableVal {
 	/// String.
@@ -247,6 +255,16 @@
 		}
 	}
 }
+impl From<&str> for StrValue {
+	fn from(value: &str) -> Self {
+		Self::Flat(value.into())
+	}
+}
+impl From<String> for StrValue {
+	fn from(value: String) -> Self {
+		Self::Flat(value.into())
+	}
+}
 impl Display for StrValue {
 	fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
 		match self {
modifiedcrates/jrsonnet-parser/src/source.rsdiffbeforeafterboth
before · crates/jrsonnet-parser/src/source.rs
1use std::{2	any::Any,3	fmt::{self, Debug, Display},4	hash::{Hash, Hasher},5	path::{Path, PathBuf},6	rc::Rc,7};89use jrsonnet_gcmodule::{Trace, Tracer};10use jrsonnet_interner::IStr;11#[cfg(feature = "serde")]12use serde::{Deserialize, Serialize};13#[cfg(feature = "structdump")]14use structdump::Codegen;1516use crate::location::{location_to_offset, offset_to_location, CodeLocation};1718macro_rules! any_ext_methods {19	($T:ident) => {20		fn as_any(&self) -> &dyn Any;21		fn dyn_hash(&self, hasher: &mut dyn Hasher);22		fn dyn_eq(&self, other: &dyn $T) -> bool;23		fn dyn_debug(&self, fmt: &mut std::fmt::Formatter<'_>) -> std::fmt::Result;24	};25}26macro_rules! any_ext_impl {27	($T:ident) => {28		fn as_any(&self) -> &dyn Any {29			self30		}31		fn dyn_hash(&self, mut hasher: &mut dyn Hasher) {32			self.hash(&mut hasher)33		}34		fn dyn_eq(&self, other: &dyn $T) -> bool {35			let Some(other) = other.as_any().downcast_ref::<Self>() else {36												return false37											};38			let this = <Self as $T>::as_any(self)39				.downcast_ref::<Self>()40				.expect("restricted by impl");41			this == other42		}43		fn dyn_debug(&self, fmt: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {44			<Self as std::fmt::Debug>::fmt(self, fmt)45		}46	};47}48macro_rules! any_ext {49	($T:ident) => {50		impl Hash for dyn $T {51			fn hash<H: Hasher>(&self, state: &mut H) {52				self.dyn_hash(state)53			}54		}55		impl PartialEq for dyn $T {56			fn eq(&self, other: &Self) -> bool {57				self.dyn_eq(other)58			}59		}60		impl Eq for dyn $T {}61	};62}63pub trait SourcePathT: Trace + Debug + Display {64	/// This method should be checked by resolver before panicking with bad SourcePath input65	/// if `true` - then resolver may threat this path as default, and default is usally a CWD66	fn is_default(&self) -> bool;67	fn path(&self) -> Option<&Path>;68	any_ext_methods!(SourcePathT);69}70any_ext!(SourcePathT);7172/// Represents location of a file73///74/// Standard CLI only operates using75/// - [`SourceFile`] - for any file76/// - [`SourceDirectory`] - for resolution from CWD77/// - [`SourceVirtual`] - for stdlib/ext-str78///79/// From all of those, only [`SourceVirtual`] may be constructed manually, any other path kind should be only obtained80/// from assigned `ImportResolver`81/// However, you should always check `is_default` method return, as it will return true for any paths, where default82/// search location is applicable83///84/// Resolver may also return custom implementations of this trait, for example it may return http url in case of remotely loaded files85#[derive(Eq, Debug, Clone)]86pub struct SourcePath(Rc<dyn SourcePathT>);87impl SourcePath {88	pub fn new(inner: impl SourcePathT) -> Self {89		Self(Rc::new(inner))90	}91	pub fn downcast_ref<T: SourcePathT>(&self) -> Option<&T> {92		self.0.as_any().downcast_ref()93	}94	pub fn is_default(&self) -> bool {95		self.0.is_default()96	}97	pub fn path(&self) -> Option<&Path> {98		self.0.path()99	}100}101impl Hash for SourcePath {102	fn hash<H: Hasher>(&self, state: &mut H) {103		self.0.hash(state);104	}105}106impl PartialEq for SourcePath {107	#[allow(clippy::op_ref)]108	fn eq(&self, other: &Self) -> bool {109		&*self.0 == &*other.0110	}111}112impl Trace for SourcePath {113	fn trace(&self, tracer: &mut Tracer) {114		(*self.0).trace(tracer)115	}116117	fn is_type_tracked() -> bool118	where119		Self: Sized,120	{121		true122	}123}124impl Display for SourcePath {125	fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {126		write!(f, "{}", self.0)127	}128}129impl Default for SourcePath {130	fn default() -> Self {131		Self(Rc::new(SourceDefault))132	}133}134135#[cfg(feature = "structdump")]136impl Codegen for SourcePath {137	fn gen_code(138		&self,139		res: &mut structdump::CodegenResult,140		unique: bool,141	) -> structdump::TokenStream {142		let source_virtual = self143			.0144			.as_any()145			.downcast_ref::<SourceVirtual>()146			.expect("can only codegen for virtual source paths!")147			.0148			.clone();149		let val = res.add_value(source_virtual, false);150		res.add_code(151			structdump::quote! {152				structdump_import::SourcePath::new(structdump_import::SourceVirtual(#val))153			},154			Some(structdump::quote!(SourcePath)),155			unique,156		)157	}158}159160#[derive(Trace, Hash, PartialEq, Eq, Debug)]161struct SourceDefault;162impl Display for SourceDefault {163	fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {164		write!(f, "<default>")165	}166}167impl SourcePathT for SourceDefault {168	fn is_default(&self) -> bool {169		true170	}171	fn path(&self) -> Option<&Path> {172		None173	}174	any_ext_impl!(SourcePathT);175}176177/// Represents path to the file on the disk178/// Directories shouldn't be put here, as resolution for files differs from resolution for directories:179///180/// When `file` is being resolved from `SourceFile(a/b/c)`, it should be resolved to `SourceFile(a/b/file)`,181/// however if it is being resolved from `SourceDirectory(a/b/c)`, then it should be resolved to `SourceDirectory(a/b/c/file)`182#[derive(Trace, Hash, PartialEq, Eq, Debug)]183pub struct SourceFile(PathBuf);184impl SourceFile {185	pub fn new(path: PathBuf) -> Self {186		Self(path)187	}188	pub fn path(&self) -> &Path {189		&self.0190	}191}192impl Display for SourceFile {193	fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {194		write!(f, "{}", self.0.display())195	}196}197impl SourcePathT for SourceFile {198	fn is_default(&self) -> bool {199		false200	}201	fn path(&self) -> Option<&Path> {202		Some(&self.0)203	}204	any_ext_impl!(SourcePathT);205}206207/// Represents path to the directory on the disk208///209/// See also [`SourceFile`]210#[derive(Trace, Hash, PartialEq, Eq, Debug)]211pub struct SourceDirectory(PathBuf);212impl SourceDirectory {213	pub fn new(path: PathBuf) -> Self {214		Self(path)215	}216	pub fn path(&self) -> &Path {217		&self.0218	}219}220impl Display for SourceDirectory {221	fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {222		write!(f, "{}", self.0.display())223	}224}225impl SourcePathT for SourceDirectory {226	fn is_default(&self) -> bool {227		false228	}229	fn path(&self) -> Option<&Path> {230		Some(&self.0)231	}232	any_ext_impl!(SourcePathT);233}234235/// Represents virtual file, whose are located in memory, and shouldn't be cached236///237/// It is used for --ext-code=.../--tla-code=.../standard library source code by default,238/// and user can construct arbitrary values by hand, without asking import resolver239#[cfg_attr(feature = "structdump", derive(Codegen))]240#[derive(Trace, Hash, PartialEq, Eq, Debug, Clone)]241pub struct SourceVirtual(pub IStr);242impl Display for SourceVirtual {243	fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {244		write!(f, "{}", self.0)245	}246}247impl SourcePathT for SourceVirtual {248	fn is_default(&self) -> bool {249		true250	}251	fn path(&self) -> Option<&Path> {252		None253	}254	any_ext_impl!(SourcePathT);255}256257/// Either real file, or virtual258/// Hash of FileName always have same value as raw Path, to make it possible to use with raw_entry_mut259#[cfg_attr(feature = "structdump", derive(Codegen))]260#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]261#[derive(Clone, PartialEq, Eq, Debug)]262pub struct Source(pub Rc<(SourcePath, IStr)>);263264impl Trace for Source {265	fn trace(&self, _tracer: &mut Tracer) {}266267	fn is_type_tracked() -> bool {268		false269	}270}271272impl Source {273	pub fn new(path: SourcePath, code: IStr) -> Self {274		Self(Rc::new((path, code)))275	}276277	pub fn new_virtual(name: IStr, code: IStr) -> Self {278		Self::new(SourcePath::new(SourceVirtual(name)), code)279	}280281	pub fn code(&self) -> &str {282		&self.0 .1283	}284285	pub fn source_path(&self) -> &SourcePath {286		&self.0 .0287	}288289	pub fn map_source_locations<const S: usize>(&self, locs: &[u32; S]) -> [CodeLocation; S] {290		offset_to_location(&self.0 .1, locs)291	}292	pub fn map_from_source_location(&self, line: usize, column: usize) -> Option<usize> {293		location_to_offset(&self.0 .1, line, column)294	}295}
modifiedcrates/jrsonnet-stdlib/src/lib.rsdiffbeforeafterboth
--- a/crates/jrsonnet-stdlib/src/lib.rs
+++ b/crates/jrsonnet-stdlib/src/lib.rs
@@ -211,7 +211,7 @@
 				locs[0].line
 			);
 		}
-		eprintln!(" {}", value);
+		eprintln!(" {value}");
 	}
 }
 
@@ -229,7 +229,7 @@
 }
 
 fn extvar_source(name: &str, code: impl Into<IStr>) -> Source {
-	let source_name = format!("<extvar:{}>", name);
+	let source_name = format!("<extvar:{name}>");
 	Source::new_virtual(source_name.into(), code.into())
 }
 
modifiedcrates/jrsonnet-stdlib/src/misc.rsdiffbeforeafterboth
--- a/crates/jrsonnet-stdlib/src/misc.rs
+++ b/crates/jrsonnet-stdlib/src/misc.rs
@@ -46,7 +46,7 @@
 		.ext_natives
 		.get(&x)
 		.cloned()
-		.map_or(Val::Null, |v| Val::Func(FuncVal::Builtin(v.clone())))
+		.map_or(Val::Null, |v| Val::Func(FuncVal::Builtin(v)))
 }
 
 #[builtin(fields(
modifiedcrates/jrsonnet-stdlib/src/parse.rsdiffbeforeafterboth
--- a/crates/jrsonnet-stdlib/src/parse.rs
+++ b/crates/jrsonnet-stdlib/src/parse.rs
@@ -8,7 +8,7 @@
 #[builtin]
 pub fn builtin_parse_json(str: IStr) -> Result<Val> {
 	let value: Val = serde_json::from_str(&str)
-		.map_err(|e| RuntimeError(format!("failed to parse json: {}", e).into()))?;
+		.map_err(|e| RuntimeError(format!("failed to parse json: {e}").into()))?;
 	Ok(value)
 }
 
@@ -22,7 +22,7 @@
 	let mut out = vec![];
 	for item in value {
 		let val = Val::deserialize(item)
-			.map_err(|e| RuntimeError(format!("failed to parse yaml: {}", e).into()))?;
+			.map_err(|e| RuntimeError(format!("failed to parse yaml: {e}").into()))?;
 		out.push(val);
 	}
 	Ok(if out.is_empty() {
modifiedcrates/jrsonnet-types/src/lib.rsdiffbeforeafterboth
--- a/crates/jrsonnet-types/src/lib.rs
+++ b/crates/jrsonnet-types/src/lib.rs
@@ -150,7 +150,7 @@
 		if should_add_braces {
 			write!(f, "(")?;
 		}
-		write!(f, "{}", v)?;
+		write!(f, "{v}")?;
 		if should_add_braces {
 			write!(f, ")")?;
 		}
@@ -162,7 +162,7 @@
 	if *a == ComplexValType::Any {
 		write!(f, "array")?
 	} else {
-		write!(f, "Array<{}>", a)?
+		write!(f, "Array<{a}>")?
 	}
 	Ok(())
 }
@@ -171,7 +171,7 @@
 	fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
 		match self {
 			ComplexValType::Any => write!(f, "any")?,
-			ComplexValType::Simple(s) => write!(f, "{}", s)?,
+			ComplexValType::Simple(s) => write!(f, "{s}")?,
 			ComplexValType::Char => write!(f, "char")?,
 			ComplexValType::BoundedNumber(a, b) => write!(
 				f,
@@ -187,7 +187,7 @@
 					if i != 0 {
 						write!(f, ", ")?;
 					}
-					write!(f, "{}: {}", k, v)?;
+					write!(f, "{k}: {v}")?;
 				}
 				write!(f, "}}")?;
 			}