Просмотр исходного кода

Fixes for rust 1.67 clippy (#1136)

Signed-off-by: Sean Young <sean@mess.org>
Sean Young 2 лет назад
Родитель
Сommit
743d898669
63 измененных файлов с 396 добавлено и 461 удалено
  1. 3 3
      build.rs
  2. 16 16
      solang-parser/src/lexer.rs
  3. 1 1
      solang-parser/src/test.rs
  4. 7 7
      src/abi/anchor.rs
  5. 10 10
      src/bin/idl/mod.rs
  6. 15 15
      src/bin/languageserver/mod.rs
  7. 6 12
      src/bin/solang.rs
  8. 10 10
      src/codegen/cfg.rs
  9. 4 4
      src/codegen/constant_folding.rs
  10. 5 5
      src/codegen/dead_storage.rs
  11. 2 2
      src/codegen/dispatch.rs
  12. 2 2
      src/codegen/encoding/mod.rs
  13. 10 18
      src/codegen/mod.rs
  14. 4 4
      src/codegen/reaching_definitions.rs
  15. 1 1
      src/codegen/strength_reduce/value.rs
  16. 4 4
      src/codegen/unused_variable.rs
  17. 3 3
      src/codegen/vartable.rs
  18. 1 1
      src/codegen/yul/statements.rs
  19. 2 2
      src/emit/binary.rs
  20. 6 7
      src/emit/expression.rs
  21. 1 1
      src/emit/instructions.rs
  22. 1 1
      src/emit/mod.rs
  23. 1 1
      src/emit/solana/target.rs
  24. 1 1
      src/emit/storage.rs
  25. 6 6
      src/emit/substrate/mod.rs
  26. 1 1
      src/emit/substrate/storage.rs
  27. 1 1
      src/emit/substrate/target.rs
  28. 2 2
      src/linker/bpf.rs
  29. 2 2
      src/linker/wasm.rs
  30. 1 1
      src/sema/builtin.rs
  31. 3 3
      src/sema/contracts.rs
  32. 1 1
      src/sema/diagnostics.rs
  33. 32 32
      src/sema/dotgraphviz.rs
  34. 11 11
      src/sema/eval.rs
  35. 1 2
      src/sema/expression/constructor.rs
  36. 3 5
      src/sema/expression/function_call.rs
  37. 2 2
      src/sema/expression/integers.rs
  38. 10 14
      src/sema/expression/literals.rs
  39. 13 15
      src/sema/expression/mod.rs
  40. 1 1
      src/sema/expression/strings.rs
  41. 3 3
      src/sema/format.rs
  42. 14 17
      src/sema/functions.rs
  43. 1 1
      src/sema/mod.rs
  44. 7 9
      src/sema/namespace.rs
  45. 8 21
      src/sema/statements.rs
  46. 3 3
      src/sema/tags.rs
  47. 16 19
      src/sema/types.rs
  48. 6 6
      src/sema/unused_variable.rs
  49. 7 7
      src/sema/using.rs
  50. 5 8
      src/sema/variables.rs
  51. 5 9
      src/sema/yul/expression.rs
  52. 3 3
      tests/codegen.rs
  53. 1 1
      tests/contract.rs
  54. 1 2
      tests/doc_examples.rs
  55. 4 4
      tests/imports.rs
  56. 14 20
      tests/solana.rs
  57. 5 5
      tests/solana_tests/builtin.rs
  58. 1 1
      tests/solana_tests/create_contract.rs
  59. 1 1
      tests/solana_tests/events.rs
  60. 15 15
      tests/solana_tests/primitives.rs
  61. 61 67
      tests/substrate.rs
  62. 8 8
      tests/substrate_tests/expressions.rs
  63. 1 1
      tests/substrate_tests/strings.rs

+ 3 - 3
build.rs

@@ -34,9 +34,9 @@ fn main() {
             .unwrap();
         let libdir = String::from_utf8(libdir.stdout).unwrap();
 
-        println!("cargo:libdir={}", libdir);
+        println!("cargo:libdir={libdir}");
         for lib in &["lldELF", "lldCommon", "lldWasm"] {
-            println!("cargo:rustc-link-lib=static={}", lib);
+            println!("cargo:rustc-link-lib=static={lib}");
         }
 
         // And all the symbols we're not using, needed by Windows and debug builds
@@ -53,7 +53,7 @@ fn main() {
         String::from_utf8(output.stdout).unwrap()
     };
 
-    println!("cargo:rustc-env=SOLANG_VERSION={}", solang_version);
+    println!("cargo:rustc-env=SOLANG_VERSION={solang_version}");
 
     // Make sure we have an 8MiB stack on Windows. Windows defaults to a 1MB
     // stack, which is not big enough for debug builds

+ 16 - 16
solang-parser/src/lexer.rs

@@ -185,23 +185,23 @@ pub enum Token<'input> {
 impl<'input> fmt::Display for Token<'input> {
     fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         match self {
-            Token::Identifier(id) => write!(f, "{}", id),
-            Token::StringLiteral(false, s) => write!(f, "\"{}\"", s),
-            Token::StringLiteral(true, s) => write!(f, "unicode\"{}\"", s),
-            Token::HexLiteral(hex) => write!(f, "{}", hex),
-            Token::AddressLiteral(address) => write!(f, "{}", address),
-            Token::Number(integer, exp) if exp.is_empty() => write!(f, "{}", integer),
-            Token::Number(integer, exp) => write!(f, "{}e{}", integer, exp),
+            Token::Identifier(id) => write!(f, "{id}"),
+            Token::StringLiteral(false, s) => write!(f, "\"{s}\""),
+            Token::StringLiteral(true, s) => write!(f, "unicode\"{s}\""),
+            Token::HexLiteral(hex) => write!(f, "{hex}"),
+            Token::AddressLiteral(address) => write!(f, "{address}"),
+            Token::Number(integer, exp) if exp.is_empty() => write!(f, "{integer}"),
+            Token::Number(integer, exp) => write!(f, "{integer}e{exp}"),
             Token::RationalNumber(integer, fraction, exp) if exp.is_empty() => {
-                write!(f, "{}.{}", integer, fraction)
+                write!(f, "{integer}.{fraction}")
             }
             Token::RationalNumber(integer, fraction, exp) => {
-                write!(f, "{}.{}e{}", integer, fraction, exp)
+                write!(f, "{integer}.{fraction}e{exp}")
             }
-            Token::HexNumber(n) => write!(f, "{}", n),
-            Token::Uint(w) => write!(f, "uint{}", w),
-            Token::Int(w) => write!(f, "int{}", w),
-            Token::Bytes(w) => write!(f, "bytes{}", w),
+            Token::HexNumber(n) => write!(f, "{n}"),
+            Token::Uint(w) => write!(f, "uint{w}"),
+            Token::Int(w) => write!(f, "int{w}"),
+            Token::Bytes(w) => write!(f, "bytes{w}"),
             Token::Byte => write!(f, "byte"),
             Token::DynamicBytes => write!(f, "bytes"),
             Token::Semicolon => write!(f, ";"),
@@ -363,10 +363,10 @@ impl fmt::Display for LexicalError {
             }
             LexicalError::MissingNumber(..) => write!(f, "missing number"),
             LexicalError::InvalidCharacterInHexLiteral(_, ch) => {
-                write!(f, "invalid character '{}' in hex literal string", ch)
+                write!(f, "invalid character '{ch}' in hex literal string")
             }
-            LexicalError::UnrecognisedToken(_, t) => write!(f, "unrecognised token '{}'", t),
-            LexicalError::ExpectedFrom(_, t) => write!(f, "'{}' found where 'from' expected", t),
+            LexicalError::UnrecognisedToken(_, t) => write!(f, "unrecognised token '{t}'"),
+            LexicalError::ExpectedFrom(_, t) => write!(f, "'{t}' found where 'from' expected"),
             LexicalError::MissingExponent(..) => write!(f, "missing number"),
         }
     }

+ 1 - 1
solang-parser/src/test.rs

@@ -1230,7 +1230,7 @@ fn test_libsolidity() {
                 crate::parse(&source_part, 0)
             }) {
                 Ok(result) => result,
-                Err(err) => return Some(format!("{:?}: \n\t{}", path, err)),
+                Err(err) => return Some(format!("{path:?}: \n\t{err}")),
             };
 
             if let (Err(err), false) = (

+ 7 - 7
src/abi/anchor.rs

@@ -29,7 +29,7 @@ pub fn discriminator(namespace: &'static str, name: &str) -> Vec<u8> {
         .from_case(Case::Camel)
         .without_boundaries(&[Boundary::LowerDigit])
         .to_case(Case::Snake);
-    hasher.update(format!("{}:{}", namespace, normalized));
+    hasher.update(format!("{namespace}:{normalized}"));
     hasher.finalize()[..8].to_vec()
 }
 
@@ -246,7 +246,7 @@ impl TypeManager<'_> {
             });
         }
 
-        let name = format!("{}_returns", effective_name);
+        let name = format!("{effective_name}_returns");
         self.returns_structs.push(IdlTypeDefinition {
             name: name.clone(),
             docs: Some(vec![format!(
@@ -274,7 +274,7 @@ impl TypeManager<'_> {
             || other_contract.as_ref().unwrap() == &self.namespace.contracts[self.contract_no].name
         {
             let new_name = if let Some(this_name) = contract {
-                format!("{}_{}", this_name, type_name)
+                format!("{this_name}_{type_name}")
             } else {
                 type_name.clone()
             };
@@ -283,9 +283,9 @@ impl TypeManager<'_> {
             // If the type we are adding now belongs to the current contract, we change the name
             // of a previously added IDL type
             let new_other_name = if let Some(other_name) = &other_contract {
-                format!("{}_{}", other_name, real_name)
+                format!("{other_name}_{real_name}")
             } else {
-                format!("_{}", real_name)
+                format!("_{real_name}")
             };
             let unique_name = self.unique_string(new_other_name);
             self.types[idx].name = unique_name.clone();
@@ -454,7 +454,7 @@ impl TypeManager<'_> {
         let mut unique_name = name.clone();
         while self.added_names.contains_key(&unique_name) {
             num += 1;
-            unique_name = format!("{}_{}", name, num);
+            unique_name = format!("{name}_{num}");
         }
 
         unique_name
@@ -514,7 +514,7 @@ impl Deduplicate {
         let prefix = candidate.clone();
         while self.existing_names.contains(candidate) {
             counter += 1;
-            *candidate = format!("{}_{}", prefix, counter);
+            *candidate = format!("{prefix}_{counter}");
         }
         self.existing_names.insert(candidate.clone());
     }

+ 10 - 10
src/bin/idl/mod.rs

@@ -115,7 +115,7 @@ fn write_solidity(idl: &Idl, mut f: File) -> Result<(), std::io::Error> {
 
             let name = &ty_names.iter().find(|e| *e.0 == ty_def.name).unwrap().1;
 
-            writeln!(f, "enum {} {{", name)?;
+            writeln!(f, "enum {name} {{")?;
             let mut iter = variants.iter().enumerate();
             let mut next = iter.next();
             while let Some((no, _)) = next {
@@ -151,7 +151,7 @@ fn write_solidity(idl: &Idl, mut f: File) -> Result<(), std::io::Error> {
 
                 let name = &ty_names.iter().find(|e| *e.0 == ty_def.name).unwrap().1;
 
-                writeln!(f, "struct {} {{", name)?;
+                writeln!(f, "struct {name} {{")?;
 
                 for (no, field) in fields.iter().enumerate() {
                     docs(&mut f, 1, &field.docs)?;
@@ -194,7 +194,7 @@ fn write_solidity(idl: &Idl, mut f: File) -> Result<(), std::io::Error> {
 
                 let name = &ty_names.iter().find(|e| *e.0 == event.name).unwrap().1;
 
-                writeln!(f, "event {} {{", name)?;
+                writeln!(f, "event {name} {{")?;
                 let mut iter = event.fields.iter().enumerate();
                 let mut next = iter.next();
                 while let Some((no, e)) = next {
@@ -287,7 +287,7 @@ fn instruction(
         write!(
             f,
             "\t@selector([{}])\n\tfunction {}(",
-            selector.iter().map(|v| format!("{:#04x}", v)).join(","),
+            selector.iter().map(|v| format!("{v:#04x}")).join(","),
             if instr.name == "new" {
                 "initialize"
             } else {
@@ -338,7 +338,7 @@ fn docs(f: &mut File, indent: usize, docs: &Option<Vec<String>>) -> std::io::Res
             for _ in 0..indent {
                 write!(f, "\t")?;
             }
-            writeln!(f, "/// {}", doc)?;
+            writeln!(f, "/// {doc}")?;
         }
     }
 
@@ -380,12 +380,12 @@ fn idltype_to_solidity(ty: &IdlType, ty_names: &[(String, String)]) -> Result<St
             }
         }
         IdlType::Vec(ty) => match idltype_to_solidity(ty, ty_names) {
-            Ok(ty) => Ok(format!("{}[]", ty)),
-            Err(ty) => Err(format!("{}[]", ty)),
+            Ok(ty) => Ok(format!("{ty}[]")),
+            Err(ty) => Err(format!("{ty}[]")),
         },
         IdlType::Array(ty, size) => match idltype_to_solidity(ty, ty_names) {
-            Ok(ty) => Ok(format!("{}[{}]", ty, size)),
-            Err(ty) => Err(format!("{}[{}]", ty, size)),
+            Ok(ty) => Ok(format!("{ty}[{size}]")),
+            Err(ty) => Err(format!("{ty}[{size}]")),
         },
     }
 }
@@ -410,7 +410,7 @@ fn rename_keywords(name_map: &mut Vec<(String, String)>) {
         if is_keyword(name) {
             let mut name = name.to_owned();
             loop {
-                name = format!("_{}", name);
+                name = format!("_{name}");
                 if name_map.iter().all(|(_, n)| *n != name) {
                     break;
                 }

+ 15 - 15
src/bin/languageserver/mod.rs

@@ -92,14 +92,14 @@ impl SolangServer {
                         resolver.add_import_map(OsString::from(map), PathBuf::from(path))
                     {
                         diags.push(Diagnostic {
-                            message: format!("error: import path '{}': {}", path, e),
+                            message: format!("error: import path '{path}': {e}"),
                             severity: Some(DiagnosticSeverity::ERROR),
                             ..Default::default()
                         });
                     }
                 } else {
                     diags.push(Diagnostic {
-                        message: format!("error: import map '{}': contains no '='", p),
+                        message: format!("error: import map '{p}': contains no '='"),
                         severity: Some(DiagnosticSeverity::ERROR),
                         ..Default::default()
                     });
@@ -199,7 +199,7 @@ impl<'a> Builder<'a> {
                         }
                         codegen::Expression::NumberLiteral(_, ast::Type::Uint(_), n)
                         | codegen::Expression::NumberLiteral(_, ast::Type::Int(_), n) => {
-                            write!(val, " = {}", n).unwrap();
+                            write!(val, " = {n}").unwrap();
                         }
                         _ => (),
                     }
@@ -544,7 +544,7 @@ impl<'a> Builder<'a> {
                         }
                         codegen::Expression::NumberLiteral(_, ast::Type::Uint(_), n)
                         | codegen::Expression::NumberLiteral(_, ast::Type::Int(_), n) => {
-                            write!(val, " {}", n).unwrap();
+                            write!(val, " {n}").unwrap();
                         }
                         _ => (),
                     }
@@ -663,10 +663,10 @@ impl<'a> Builder<'a> {
                             parm.name_as_str(),
                             self.expanded_ty(&parm.ty)
                         );
-                        val = format!("{} {}", val, msg);
+                        val = format!("{val} {msg}");
                     }
 
-                    val = format!("{} ) returns (", val);
+                    val = format!("{val} ) returns (");
 
                     for ret in &*fnc.returns {
                         let msg = format!(
@@ -674,10 +674,10 @@ impl<'a> Builder<'a> {
                             ret.name_as_str(),
                             self.expanded_ty(&ret.ty)
                         );
-                        val = format!("{} {}", val, msg);
+                        val = format!("{val} {msg}");
                     }
 
-                    val = format!("{})", val);
+                    val = format!("{val})");
                     self.hovers.push(HoverEntry {
                         start: loc.start(),
                         stop: loc.end(),
@@ -713,10 +713,10 @@ impl<'a> Builder<'a> {
                             parm.name_as_str(),
                             self.expanded_ty(&parm.ty)
                         );
-                        val = format!("{} {}", val, msg);
+                        val = format!("{val} {msg}");
                     }
 
-                    val = format!("{} ) \n\n returns (", val);
+                    val = format!("{val} ) \n\n returns (");
 
                     for ret in &*fnc.returns {
                         let msg = format!(
@@ -724,10 +724,10 @@ impl<'a> Builder<'a> {
                             ret.name_as_str(),
                             self.expanded_ty(&ret.ty)
                         );
-                        val = format!("{} {}", val, msg);
+                        val = format!("{val} {msg}");
                     }
 
-                    val = format!("{})", val);
+                    val = format!("{val})");
                     self.hovers.push(HoverEntry {
                         start: loc.start(),
                         stop: loc.end(),
@@ -852,7 +852,7 @@ impl<'a> Builder<'a> {
 
         for enum_decl in &builder.ns.enums {
             for (discriminant, (nam, loc)) in enum_decl.values.iter().enumerate() {
-                let val = format!("{} {}, \n\n", nam, discriminant);
+                let val = format!("{nam} {discriminant}, \n\n");
                 builder.hovers.push(HoverEntry {
                     start: loc.start(),
                     stop: loc.end(),
@@ -995,7 +995,7 @@ impl<'a> Builder<'a> {
 
                 let mut msg = render(&strct.tags);
 
-                writeln!(msg, "```\nstruct {} {{", strct).unwrap();
+                writeln!(msg, "```\nstruct {strct} {{").unwrap();
 
                 let mut iter = strct.fields.iter().peekable();
                 while let Some(field) = iter.next() {
@@ -1018,7 +1018,7 @@ impl<'a> Builder<'a> {
 
                 let mut msg = render(&enm.tags);
 
-                write!(msg, "```\nenum {} {{\n", enm).unwrap();
+                write!(msg, "```\nenum {enm} {{\n").unwrap();
 
                 // display the enum values in-order
                 let mut values = Vec::new();

+ 6 - 12
src/bin/solang.rs

@@ -455,7 +455,7 @@ fn output_file(matches: &ArgMatches, stem: &str, ext: &str) -> PathBuf {
             .get_one::<OsString>("OUTPUT")
             .unwrap_or(&OsString::from(".")),
     )
-    .join(format!("{}.{}", stem, ext))
+    .join(format!("{stem}.{ext}"))
 }
 
 fn process_file(
@@ -634,7 +634,7 @@ fn save_intermediates(binary: &solang::emit::binary::Binary, matches: &ArgMatche
             let obj = match binary.code(Generate::Object) {
                 Ok(o) => o,
                 Err(s) => {
-                    println!("error: {}", s);
+                    println!("error: {s}");
                     exit(1);
                 }
             };
@@ -657,7 +657,7 @@ fn save_intermediates(binary: &solang::emit::binary::Binary, matches: &ArgMatche
             let obj = match binary.code(Generate::Assembly) {
                 Ok(o) => o,
                 Err(s) => {
-                    println!("error: {}", s);
+                    println!("error: {s}");
                     exit(1);
                 }
             };
@@ -721,20 +721,14 @@ fn target_arg(matches: &ArgMatches) -> Target {
     if !target.is_substrate()
         && matches.value_source("ADDRESS_LENGTH") == Some(ValueSource::CommandLine)
     {
-        eprintln!(
-            "error: address length cannot be modified for target '{}'",
-            target
-        );
+        eprintln!("error: address length cannot be modified for target '{target}'");
         exit(1);
     }
 
     if !target.is_substrate()
         && matches.value_source("VALUE_LENGTH") == Some(ValueSource::CommandLine)
     {
-        eprintln!(
-            "error: value length cannot be modified for target '{}'",
-            target
-        );
+        eprintln!("error: value length cannot be modified for target '{target}'");
         exit(1);
     }
 
@@ -751,7 +745,7 @@ fn imports_arg(matches: &ArgMatches) -> FileResolver {
     }
 
     if let Err(e) = resolver.add_import_path(&PathBuf::from(".")) {
-        eprintln!("error: cannot add current directory to import path: {}", e);
+        eprintln!("error: cannot add current directory to import path: {e}");
         exit(1);
     }
 

+ 10 - 10
src/codegen/cfg.rs

@@ -569,7 +569,7 @@ impl ControlFlowGraph {
 
     pub fn expr_to_string(&self, contract: &Contract, ns: &Namespace, expr: &Expression) -> String {
         match expr {
-            Expression::FunctionArg(_, _, pos) => format!("(arg #{})", pos),
+            Expression::FunctionArg(_, _, pos) => format!("(arg #{pos})"),
             Expression::BoolLiteral(_, false) => "false".to_string(),
             Expression::BoolLiteral(_, true) => "true".to_string(),
             Expression::BytesLiteral(_, Type::String, s) => {
@@ -594,7 +594,7 @@ impl ControlFlowGraph {
             ),
             Expression::ConstArrayLiteral(_, _, dims, exprs) => format!(
                 "constant {} [ {} ]",
-                dims.iter().map(|d| format!("[{}]", d)).collect::<String>(),
+                dims.iter().map(|d| format!("[{d}]")).collect::<String>(),
                 exprs
                     .iter()
                     .map(|e| self.expr_to_string(contract, ns, e))
@@ -603,7 +603,7 @@ impl ControlFlowGraph {
             ),
             Expression::ArrayLiteral(_, _, dims, exprs) => format!(
                 "{} [ {} ]",
-                dims.iter().map(|d| format!("[{}]", d)).collect::<String>(),
+                dims.iter().map(|d| format!("[{d}]")).collect::<String>(),
                 exprs
                     .iter()
                     .map(|e| self.expr_to_string(contract, ns, e))
@@ -679,7 +679,7 @@ impl ControlFlowGraph {
                 if let Some(var) = self.vars.get(res) {
                     format!("%{}", var.id.name)
                 } else {
-                    panic!("error: non-existing variable {} in CFG", res);
+                    panic!("error: non-existing variable {res} in CFG");
                 }
             }
             Expression::Load(_, _, expr) => {
@@ -864,7 +864,7 @@ impl ControlFlowGraph {
             Expression::GetRef(_, _, expr) => {
                 format!("(deref {}", self.expr_to_string(contract, ns, expr))
             }
-            _ => panic!("{:?}", expr),
+            _ => panic!("{expr:?}"),
         }
     }
 
@@ -899,7 +899,7 @@ impl ControlFlowGraph {
                 self.vars[res].id.name,
                 self.expr_to_string(contract, ns, expr)
             ),
-            Instr::Branch { block } => format!("branch block{}", block),
+            Instr::Branch { block } => format!("branch block{block}"),
             Instr::BranchCond {
                 cond,
                 true_block,
@@ -1122,11 +1122,11 @@ impl ControlFlowGraph {
                     self.expr_to_string(contract, ns, data),
                     selector
                         .iter()
-                        .map(|s| format!("selector:0x{:08x} ", s))
+                        .map(|s| format!("selector:0x{s:08x} "))
                         .collect::<String>(),
                     exception
                         .iter()
-                        .map(|block| format!("exception: block{} ", block))
+                        .map(|block| format!("exception: block{block} "))
                         .collect::<String>(),
                     tys.iter()
                         .map(|ty| ty.ty.to_string(ns))
@@ -1245,7 +1245,7 @@ impl ControlFlowGraph {
                         .as_str(),
                     );
                 }
-                description.push_str(format!("\n\t\tdefault: goto block #{}", default).as_str());
+                description.push_str(format!("\n\t\tdefault: goto block #{default}").as_str());
                 description
             }
 
@@ -1258,7 +1258,7 @@ impl ControlFlowGraph {
             }
 
             Instr::ReturnCode { code } => {
-                format!("return code: {}", code)
+                format!("return code: {code}")
             }
         }
     }

+ 4 - 4
src/codegen/constant_folding.rs

@@ -508,7 +508,7 @@ fn expression(
                 if right.sign() == Sign::Minus || right >= &BigInt::from(left_expr.ty().bits(ns)) {
                     ns.diagnostics.push(Diagnostic::error(
                         *loc,
-                        format!("left shift by {} is not possible", right),
+                        format!("left shift by {right} is not possible"),
                     ));
                 } else {
                     let right: u64 = right.to_u64().unwrap();
@@ -531,7 +531,7 @@ fn expression(
                 if right.sign() == Sign::Minus || right >= &BigInt::from(left_expr.ty().bits(ns)) {
                     ns.diagnostics.push(Diagnostic::error(
                         *loc,
-                        format!("right shift by {} is not possible", right),
+                        format!("right shift by {right} is not possible"),
                     ));
                 } else {
                     let right: u64 = right.to_u64().unwrap();
@@ -561,7 +561,7 @@ fn expression(
                 if right.sign() == Sign::Minus || right >= &BigInt::from(u32::MAX) {
                     ns.diagnostics.push(Diagnostic::error(
                         *loc,
-                        format!("power {} not possible", right),
+                        format!("power {right} not possible"),
                     ));
                 } else {
                     let right: u32 = right.to_u32().unwrap();
@@ -1165,7 +1165,7 @@ fn expression(
         | Expression::GetRef(..)
         | Expression::InternalFunctionCfg(_) => (expr.clone(), false),
         // nothing else is permitted in cfg
-        _ => panic!("expr should not be in cfg: {:?}", expr),
+        _ => panic!("expr should not be in cfg: {expr:?}"),
     }
 }
 

+ 5 - 5
src/codegen/dead_storage.rs

@@ -29,7 +29,7 @@ impl fmt::Display for Definition {
                 instr_no,
                 assignment_no,
             } => {
-                write!(f, "({}, {}, {})", block_no, instr_no, assignment_no)
+                write!(f, "({block_no}, {instr_no}, {assignment_no})")
             }
         }
     }
@@ -59,16 +59,16 @@ impl fmt::Display for Transfer {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         match self {
             Transfer::Gen { def, var_no } => {
-                write!(f, "Gen %{} = {}", var_no, def)
+                write!(f, "Gen %{var_no} = {def}")
             }
             Transfer::Copy { var_no, src } => {
-                write!(f, "Copy %{} from %{}", var_no, src)
+                write!(f, "Copy %{var_no} from %{src}")
             }
             Transfer::Kill { var_no } => {
-                write!(f, "Kill %{}", var_no)
+                write!(f, "Kill %{var_no}")
             }
             Transfer::Store { def, expr } => {
-                write!(f, "Storage: {:?} at {}", expr, def)
+                write!(f, "Storage: {expr:?} at {def}")
             }
         }
     }

+ 2 - 2
src/codegen/dispatch.rs

@@ -264,7 +264,7 @@ fn add_function_dispatch_case(
     vartab: &mut Vartable,
     cfg: &mut ControlFlowGraph,
 ) -> usize {
-    let entry = cfg.new_basic_block(format!("function_cfg_{}", cfg_no));
+    let entry = cfg.new_basic_block(format!("function_cfg_{cfg_no}"));
     cfg.set_basic_block(entry);
 
     // check for magic in data account, to see if data account is initialized
@@ -385,7 +385,7 @@ fn add_constructor_dispatch_case(
     cfg: &mut ControlFlowGraph,
     opt: &Options,
 ) -> usize {
-    let entry = cfg.new_basic_block(format!("constructor_cfg_{}", cfg_no));
+    let entry = cfg.new_basic_block(format!("constructor_cfg_{cfg_no}"));
     cfg.set_basic_block(entry);
 
     let mut returns: Vec<Expression> = Vec::new();

+ 2 - 2
src/codegen/encoding/mod.rs

@@ -695,7 +695,7 @@ pub(super) trait AbiEncoding {
             Expression::Add(Codegen, Uint(32), false, size_var.into(), size_width.into())
         } else {
             let size_var =
-                vartab.temp_name(format!("array_bytes_size_{}", arg_no).as_str(), &Uint(32));
+                vartab.temp_name(format!("array_bytes_size_{arg_no}").as_str(), &Uint(32));
             cfg.add(
                 vartab,
                 Instr::Set {
@@ -985,7 +985,7 @@ fn set_array_loop(
     vartab: &mut Vartable,
     cfg: &mut ControlFlowGraph,
 ) -> ForLoop {
-    let index_temp = vartab.temp_name(format!("for_i_{}", dimension).as_str(), &Uint(32));
+    let index_temp = vartab.temp_name(format!("for_i_{dimension}").as_str(), &Uint(32));
 
     cfg.add(
         vartab,

+ 10 - 18
src/codegen/mod.rs

@@ -656,9 +656,7 @@ impl Expression {
 
         // When converting from literals, there is not need to trunc or extend.
         match (self, &from, to) {
-            (&Expression::NumberLiteral(_, _, ref n), p, &Type::Uint(to_len))
-                if p.is_primitive() =>
-            {
+            (Expression::NumberLiteral(_, _, n), p, &Type::Uint(to_len)) if p.is_primitive() => {
                 return if n.sign() == Sign::Minus {
                     let mut bs = n.to_signed_bytes_le();
                     bs.resize(to_len as usize / 8, 0xff);
@@ -671,43 +669,37 @@ impl Expression {
                     Expression::NumberLiteral(self.loc(), Type::Uint(to_len), n.clone())
                 }
             }
-            (&Expression::NumberLiteral(_, _, ref n), p, &Type::Int(to_len))
-                if p.is_primitive() =>
-            {
+            (Expression::NumberLiteral(_, _, n), p, &Type::Int(to_len)) if p.is_primitive() => {
                 return Expression::NumberLiteral(self.loc(), Type::Int(to_len), n.clone());
             }
-            (&Expression::NumberLiteral(_, _, ref n), p, &Type::Bytes(to_len))
-                if p.is_primitive() =>
-            {
+            (Expression::NumberLiteral(_, _, n), p, &Type::Bytes(to_len)) if p.is_primitive() => {
                 return Expression::NumberLiteral(self.loc(), Type::Bytes(to_len), n.clone());
             }
-            (&Expression::NumberLiteral(_, _, ref n), p, &Type::Address(payable))
+            (Expression::NumberLiteral(_, _, n), p, &Type::Address(payable))
                 if p.is_primitive() =>
             {
                 return Expression::NumberLiteral(self.loc(), Type::Address(payable), n.clone());
             }
 
-            (&Expression::BytesLiteral(_, _, ref bs), p, &Type::Bytes(to_len))
-                if p.is_primitive() =>
-            {
+            (Expression::BytesLiteral(_, _, bs), p, &Type::Bytes(to_len)) if p.is_primitive() => {
                 let mut bs = bs.to_owned();
                 bs.resize(to_len as usize, 0);
                 return Expression::BytesLiteral(self.loc(), Type::Bytes(to_len), bs);
             }
-            (&Expression::BytesLiteral(loc, _, ref init), _, &Type::DynamicBytes)
-            | (&Expression::BytesLiteral(loc, _, ref init), _, &Type::String) => {
+            (Expression::BytesLiteral(loc, _, init), _, &Type::DynamicBytes)
+            | (Expression::BytesLiteral(loc, _, init), _, &Type::String) => {
                 return Expression::AllocDynamicBytes(
-                    loc,
+                    *loc,
                     to.clone(),
                     Box::new(Expression::NumberLiteral(
-                        loc,
+                        *loc,
                         Type::Uint(32),
                         BigInt::from(init.len()),
                     )),
                     Some(init.clone()),
                 );
             }
-            (&Expression::NumberLiteral(_, _, ref n), _, &Type::Rational) => {
+            (Expression::NumberLiteral(_, _, n), _, &Type::Rational) => {
                 return Expression::RationalNumberLiteral(
                     self.loc(),
                     Type::Rational,

+ 4 - 4
src/codegen/reaching_definitions.rs

@@ -25,16 +25,16 @@ impl fmt::Display for Transfer {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         match self {
             Transfer::Gen { def, var_no } => {
-                write!(f, "Gen %{} = ({}, {})", var_no, def.block_no, def.instr_no)
+                write!(f, "Gen %{var_no} = ({}, {})", def.block_no, def.instr_no)
             }
             Transfer::Mod { var_no } => {
-                write!(f, "Mod %{}", var_no)
+                write!(f, "Mod %{var_no}")
             }
             Transfer::Copy { var_no, src } => {
-                write!(f, "Copy %{} from %{}", var_no, src)
+                write!(f, "Copy %{var_no} from %{src}")
             }
             Transfer::Kill { var_no } => {
-                write!(f, "Kill %{}", var_no)
+                write!(f, "Kill %{var_no}")
             }
         }
     }

+ 1 - 1
src/codegen/strength_reduce/value.rs

@@ -46,7 +46,7 @@ fn dump_set(name: &str, set: &HashSet<Value>) {
         "{}:{}",
         name,
         set.iter()
-            .map(|v| format!("{}", v))
+            .map(|v| format!("{v}"))
             .collect::<Vec<String>>()
             .join(",")
     );

+ 4 - 4
src/codegen/unused_variable.rs

@@ -31,16 +31,16 @@ pub fn should_remove_assignment(
     match &exp {
         Expression::StorageVariable {
             contract_no,
-            var_no: offset,
+            var_no,
             ..
         } => {
-            let var = &ns.contracts[*contract_no].variables[*offset];
+            let var = &ns.contracts[*contract_no].variables[*var_no];
             !var.read
         }
 
-        Expression::Variable { var_no: offset, .. } => should_remove_variable(offset, func, opt),
+        Expression::Variable { var_no, .. } => should_remove_variable(var_no, func, opt),
 
-        Expression::StructMember { expr: str, .. } => should_remove_assignment(ns, str, func, opt),
+        Expression::StructMember { expr, .. } => should_remove_assignment(ns, expr, func, opt),
 
         Expression::Subscript { array, .. } => should_remove_assignment(ns, array, func, opt),
 

+ 3 - 3
src/codegen/vartable.rs

@@ -98,7 +98,7 @@ impl Vartable {
         let mut id = id.clone();
 
         if id.name.is_empty() {
-            id.name = format!("temp.{}", no);
+            id.name = format!("temp.{no}");
         } else if vars.iter().any(|(_, var)| var.id.name == id.name) {
             id.name = format!("{}.{}", id.name, no);
         }
@@ -122,7 +122,7 @@ impl Vartable {
             var_no,
             Variable {
                 id: pt::Identifier {
-                    name: format!("temp.{}", var_no),
+                    name: format!("temp.{var_no}"),
                     loc: pt::Loc::Codegen,
                 },
                 ty: ty.clone(),
@@ -160,7 +160,7 @@ impl Vartable {
             var_no,
             Variable {
                 id: pt::Identifier {
-                    name: format!("{}.temp.{}", name, var_no),
+                    name: format!("{name}.temp.{var_no}"),
                     loc: pt::Loc::Codegen,
                 },
                 ty: ty.clone(),

+ 1 - 1
src/codegen/yul/statements.rs

@@ -506,7 +506,7 @@ fn switch(
     for (item_no, item) in cases.iter().enumerate() {
         let case_cond =
             expression(&item.condition, contract_no, ns, vartab, cfg, opt).cast(&cond.ty(), ns);
-        let case_block = cfg.new_basic_block(format!("case_{}", item_no));
+        let case_block = cfg.new_basic_block(format!("case_{item_no}"));
         cfg.set_basic_block(case_block);
         for stmt in &item.block.body {
             statement(stmt, contract_no, loops, ns, cfg, vartab, early_return, opt);

+ 2 - 2
src/emit/binary.rs

@@ -644,7 +644,7 @@ impl<'a> Binary<'a> {
 
     // Create the llvm intrinsic for counting leading zeros
     pub fn llvm_ctlz(&self, bit: u32) -> FunctionValue<'a> {
-        let name = format!("llvm.ctlz.i{}", bit);
+        let name = format!("llvm.ctlz.i{bit}");
         let ty = self.context.custom_width_int_type(bit);
 
         if let Some(f) = self.module.get_function(&name) {
@@ -660,7 +660,7 @@ impl<'a> Binary<'a> {
 
     // Create the llvm intrinsic for bswap
     pub fn llvm_bswap(&self, bit: u32) -> FunctionValue<'a> {
-        let name = format!("llvm.bswap.i{}", bit);
+        let name = format!("llvm.bswap.i{bit}");
         let ty = self.context.custom_width_int_type(bit);
 
         if let Some(f) = self.module.get_function(&name) {

+ 6 - 7
src/emit/expression.rs

@@ -184,7 +184,7 @@ pub(super) fn expression<'a, T: TargetRuntime<'a> + ?Sized>(
             if bits > 64 {
                 let div_bits = if bits <= 128 { 128 } else { 256 };
 
-                let name = format!("udivmod{}", div_bits);
+                let name = format!("udivmod{div_bits}");
 
                 let f = bin
                     .module
@@ -278,7 +278,7 @@ pub(super) fn expression<'a, T: TargetRuntime<'a> + ?Sized>(
             if bits > 64 {
                 let div_bits = if bits <= 128 { 128 } else { 256 };
 
-                let name = format!("sdivmod{}", div_bits);
+                let name = format!("sdivmod{div_bits}");
 
                 let f = bin
                     .module
@@ -420,7 +420,7 @@ pub(super) fn expression<'a, T: TargetRuntime<'a> + ?Sized>(
             if bits > 64 {
                 let div_bits = if bits <= 128 { 128 } else { 256 };
 
-                let name = format!("udivmod{}", div_bits);
+                let name = format!("udivmod{div_bits}");
 
                 let f = bin
                     .module
@@ -511,7 +511,7 @@ pub(super) fn expression<'a, T: TargetRuntime<'a> + ?Sized>(
             if bits > 64 {
                 let div_bits = if bits <= 128 { 128 } else { 256 };
 
-                let name = format!("sdivmod{}", div_bits);
+                let name = format!("sdivmod{div_bits}");
 
                 let f = bin
                     .module
@@ -1231,8 +1231,7 @@ pub(super) fn expression<'a, T: TargetRuntime<'a> + ?Sized>(
                     e /= *d;
                 }
 
-                let elemptr =
-                    unsafe { bin.builder.build_gep(array, &ind, &format!("elemptr{}", i)) };
+                let elemptr = unsafe { bin.builder.build_gep(array, &ind, &format!("elemptr{i}")) };
 
                 let elem = expression(target, bin, expr, vartab, function, ns);
 
@@ -1328,7 +1327,7 @@ pub(super) fn expression<'a, T: TargetRuntime<'a> + ?Sized>(
                     ],
                     "",
                 );
-                bin.builder.build_load(store, &format!("bytes{}", n))
+                bin.builder.build_load(store, &format!("bytes{n}"))
             } else {
                 let start = bin.builder.build_pointer_cast(
                     start,

+ 1 - 1
src/emit/instructions.rs

@@ -1138,7 +1138,7 @@ pub(super) fn process_instruction<'a, T: TargetRuntime<'a> + ?Sized>(
                 let value_ptr = bin.build_alloca(
                     function,
                     emit_value.into_int_value().get_type(),
-                    &format!("bytes{}", is_bytes),
+                    &format!("bytes{is_bytes}"),
                 );
                 bin.builder
                     .build_store(value_ptr, emit_value.into_int_value());

+ 1 - 1
src/emit/mod.rs

@@ -241,7 +241,7 @@ pub trait TargetRuntime<'a> {
     fn return_abi<'b>(&self, bin: &'b Binary, data: PointerValue<'b>, length: IntValue);
 
     /// Return failure without any result
-    fn assert_failure<'b>(&self, bin: &'b Binary, data: PointerValue, length: IntValue);
+    fn assert_failure(&self, bin: &Binary, data: PointerValue, length: IntValue);
 
     fn builtin_function(
         &self,

+ 1 - 1
src/emit/solana/target.rs

@@ -1171,7 +1171,7 @@ impl<'a> TargetRuntime<'a> for SolanaTarget {
             .build_return(Some(&binary.context.i64_type().const_int(0, false)));
     }
 
-    fn assert_failure<'b>(&self, binary: &'b Binary, data: PointerValue, length: IntValue) {
+    fn assert_failure(&self, binary: &Binary, data: PointerValue, length: IntValue) {
         // the reason code should be null (and already printed)
         binary.builder.build_call(
             binary.module.get_function("sol_set_return_data").unwrap(),

+ 1 - 1
src/emit/storage.rs

@@ -16,7 +16,7 @@ pub(super) trait StorageSlot {
     ) -> ArrayValue<'a>;
 
     /// Clear a particlar storage slot (slot-based storage chains should implement)
-    fn storage_delete_single_slot<'a>(&self, binary: &Binary<'a>, slot: PointerValue);
+    fn storage_delete_single_slot(&self, binary: &Binary, slot: PointerValue);
 
     /// Recursively load a type from storage for slot based storage
     fn storage_load_slot<'a>(

+ 6 - 6
src/emit/substrate/mod.rs

@@ -511,7 +511,7 @@ impl SubstrateTarget {
                 );
 
                 (
-                    binary.builder.build_load(buf, &format!("bytes{}", len)),
+                    binary.builder.build_load(buf, &format!("bytes{len}")),
                     *len as u64,
                 )
             }
@@ -985,7 +985,7 @@ impl SubstrateTarget {
                 } else {
                     let temp = binary
                         .builder
-                        .build_alloca(arg.into_int_value().get_type(), &format!("bytes{}", n));
+                        .build_alloca(arg.into_int_value().get_type(), &format!("bytes{n}"));
 
                     binary.builder.build_store(temp, arg.into_int_value());
 
@@ -1832,10 +1832,10 @@ impl SubstrateTarget {
 
         let binary_name = &ns.contracts[binary_no].name;
 
-        let unique = format!("{}-{}", binary_name, counter);
+        let unique = format!("{binary_name}-{counter}");
 
         let salt = binary.emit_global_string(
-            &format!("salt_{}_{}", binary_name, counter),
+            &format!("salt_{binary_name}_{counter}"),
             blake2_rfc::blake2b::blake2b(32, &[], unique.as_bytes()).as_bytes(),
             true,
         );
@@ -1847,14 +1847,14 @@ impl SubstrateTarget {
 }
 
 /// Print the return code of API calls to the debug buffer.
-fn log_return_code<'b>(binary: &Binary<'b>, api: &'static str, code: IntValue) {
+fn log_return_code(binary: &Binary, api: &'static str, code: IntValue) {
     if !binary.options.log_api_return_codes {
         return;
     }
 
     emit_context!(binary);
 
-    let fmt = format!("{}=", api);
+    let fmt = format!("{api}=");
     let msg = fmt.as_bytes();
     let length = i32_const!(msg.len() as u64 + 16);
     let out_buf =

+ 1 - 1
src/emit/substrate/storage.rs

@@ -93,7 +93,7 @@ impl StorageSlot for SubstrateTarget {
             .into_array_value()
     }
 
-    fn storage_delete_single_slot<'a>(&self, binary: &Binary<'a>, slot: PointerValue) {
+    fn storage_delete_single_slot(&self, binary: &Binary, slot: PointerValue) {
         emit_context!(binary);
 
         let ret = call!(

+ 1 - 1
src/emit/substrate/target.rs

@@ -754,7 +754,7 @@ impl<'a> TargetRuntime<'a> for SubstrateTarget {
             .build_return(Some(&binary.return_values[&ReturnCode::Success]));
     }
 
-    fn assert_failure<'b>(&self, binary: &'b Binary, _data: PointerValue, _length: IntValue) {
+    fn assert_failure(&self, binary: &Binary, _data: PointerValue, _length: IntValue) {
         // insert "unreachable" instruction; not that build_unreachable() tells the compiler
         // that this code path is not reachable and may be discarded.
         let asm_fn = binary.context.void_type().fn_type(&[], false);

+ 2 - 2
src/linker/bpf.rs

@@ -18,8 +18,8 @@ use tempfile::tempdir;
 pub fn link(input: &[u8], name: &str) -> Vec<u8> {
     let dir = tempdir().expect("failed to create temp directory for linking");
 
-    let object_filename = dir.path().join(format!("{}.o", name));
-    let res_filename = dir.path().join(format!("{}.so", name));
+    let object_filename = dir.path().join(format!("{name}.o"));
+    let res_filename = dir.path().join(format!("{name}.so"));
     let linker_script_filename = dir.path().join("linker.ld");
 
     let mut objectfile =

+ 2 - 2
src/linker/wasm.rs

@@ -11,8 +11,8 @@ use tempfile::tempdir;
 pub fn link(input: &[u8], name: &str) -> Vec<u8> {
     let dir = tempdir().expect("failed to create temp directory for linking");
 
-    let object_filename = dir.path().join(format!("{}.o", name));
-    let res_filename = dir.path().join(format!("{}.wasm", name));
+    let object_filename = dir.path().join(format!("{name}.o"));
+    let res_filename = dir.path().join(format!("{name}.wasm"));
 
     let mut objectfile =
         File::create(object_filename.clone()).expect("failed to create object file");

+ 1 - 1
src/sema/builtin.rs

@@ -1090,7 +1090,7 @@ pub(super) fn resolve_namespace_call(
                         if let Some(storage) = &param.storage {
                             diagnostics.push(Diagnostic::error(
                                 storage.loc(),
-                                format!("storage modifier '{}' not allowed", storage),
+                                format!("storage modifier '{storage}' not allowed"),
                             ));
                             broken = true;
                         }

+ 3 - 3
src/sema/contracts.rs

@@ -127,7 +127,7 @@ pub fn resolve_base_contracts(
                 if no == contract.contract_no {
                     ns.diagnostics.push(ast::Diagnostic::error(
                         name.loc,
-                        format!("contract '{}' cannot have itself as a base contract", name),
+                        format!("contract '{name}' cannot have itself as a base contract"),
                     ));
                 } else if ns.contracts[contract.contract_no]
                     .bases
@@ -310,9 +310,9 @@ fn check_inheritance(contract_no: usize, ns: &mut ast::Namespace) {
                     {
                         diagnostics.push(ast::Diagnostic::error_with_note(
                             sym.loc(),
-                            format!("already defined '{}'", name),
+                            format!("already defined '{name}'"),
                             prev.loc(),
-                            format!("previous definition of '{}'", name),
+                            format!("previous definition of '{name}'"),
                         ));
                     }
                 }

+ 1 - 1
src/sema/diagnostics.rs

@@ -272,7 +272,7 @@ impl Namespace {
         for (file_no, file) in self.files.iter().enumerate() {
             if file.cache_no.is_some() {
                 let (contents, _) = cache.get_file_contents_and_number(&file.path);
-                file_id.insert(file_no, files.add(format!("{}", file), contents.to_owned()));
+                file_id.insert(file_no, files.add(format!("{file}"), contents.to_owned()));
             }
         }
 

+ 32 - 32
src/sema/dotgraphviz.rs

@@ -91,7 +91,7 @@ impl Dot {
         );
 
         if node.name.is_empty() || node.name == "node" {
-            node.name = format!("node_{}", no);
+            node.name = format!("node_{no}");
         } else {
             while self.nodes.iter().any(|n| n.name == node.name) {
                 node.name = format!("{}_{}", node.name, no);
@@ -245,7 +245,7 @@ impl Dot {
             );
 
             for (no, arg) in args.iter().enumerate() {
-                self.add_expression(arg, Some(func), ns, node, format!("arg #{}", no));
+                self.add_expression(arg, Some(func), ns, node, format!("arg #{no}"));
             }
         }
 
@@ -343,7 +343,7 @@ impl Dot {
                 );
 
                 for (no, arg) in values.iter().enumerate() {
-                    self.add_expression(arg, func, ns, node, format!("arg #{}", no));
+                    self.add_expression(arg, func, ns, node, format!("arg #{no}"));
                 }
             }
             Expression::ArrayLiteral {
@@ -361,7 +361,7 @@ impl Dot {
                 );
 
                 for (no, arg) in values.iter().enumerate() {
-                    self.add_expression(arg, func, ns, node, format!("arg #{}", no));
+                    self.add_expression(arg, func, ns, node, format!("arg #{no}"));
                 }
             }
             Expression::ConstArrayLiteral {
@@ -379,7 +379,7 @@ impl Dot {
                 );
 
                 for (no, arg) in values.iter().enumerate() {
-                    self.add_expression(arg, func, ns, node, format!("arg #{}", no));
+                    self.add_expression(arg, func, ns, node, format!("arg #{no}"));
                 }
             }
             Expression::Add {
@@ -1160,7 +1160,7 @@ impl Dot {
                 }
 
                 if let Some(signature) = signature {
-                    labels.insert(1, format!("signature {}", signature))
+                    labels.insert(1, format!("signature {signature}"))
                 }
 
                 self.add_node(
@@ -1211,7 +1211,7 @@ impl Dot {
                 self.add_expression(function, func, ns, node, String::from("function"));
 
                 for (no, arg) in args.iter().enumerate() {
-                    self.add_expression(arg, func, ns, node, format!("arg #{}", no));
+                    self.add_expression(arg, func, ns, node, format!("arg #{no}"));
                 }
             }
             Expression::ExternalFunctionCall {
@@ -1235,7 +1235,7 @@ impl Dot {
                 self.add_expression(function, func, ns, node, String::from("function"));
 
                 for (no, arg) in args.iter().enumerate() {
-                    self.add_expression(arg, func, ns, node, format!("arg #{}", no));
+                    self.add_expression(arg, func, ns, node, format!("arg #{no}"));
                 }
 
                 self.add_call_args(call_args, func, ns, node);
@@ -1281,7 +1281,7 @@ impl Dot {
                 );
 
                 for (no, arg) in args.iter().enumerate() {
-                    self.add_expression(arg, func, ns, node, format!("arg #{}", no));
+                    self.add_expression(arg, func, ns, node, format!("arg #{no}"));
                 }
 
                 self.add_call_args(call_args, func, ns, node);
@@ -1297,13 +1297,13 @@ impl Dot {
                 );
 
                 for (no, (_, arg)) in format.iter().enumerate() {
-                    self.add_expression(arg, func, ns, node, format!("arg #{}", no));
+                    self.add_expression(arg, func, ns, node, format!("arg #{no}"));
                 }
             }
             Expression::Builtin {
                 loc, kind, args, ..
             } => {
-                let labels = vec![format!("builtin {:?}", kind), ns.loc_to_string(loc)];
+                let labels = vec![format!("builtin {kind:?}"), ns.loc_to_string(loc)];
 
                 let node = self.add_node(
                     Node::new("builtins", labels),
@@ -1312,7 +1312,7 @@ impl Dot {
                 );
 
                 for (no, arg) in args.iter().enumerate() {
-                    self.add_expression(arg, func, ns, node, format!("arg #{}", no));
+                    self.add_expression(arg, func, ns, node, format!("arg #{no}"));
                 }
             }
             Expression::InterfaceId { loc, contract_no } => {
@@ -1333,7 +1333,7 @@ impl Dot {
                 let node = self.add_node(Node::new("list", labels), Some(parent), Some(parent_rel));
 
                 for (no, expr) in list.iter().enumerate() {
-                    self.add_expression(expr, func, ns, node, format!("entry #{}", no));
+                    self.add_expression(expr, func, ns, node, format!("entry #{no}"));
                 }
             }
         }
@@ -1517,7 +1517,7 @@ impl Dot {
                     );
 
                     for (no, field) in fields.iter().enumerate() {
-                        let parent_rel = format!("arg #{}", no);
+                        let parent_rel = format!("arg #{no}");
 
                         match field {
                             DestructureField::None => {
@@ -1597,7 +1597,7 @@ impl Dot {
                         self.add_node(Node::new("emit", labels), Some(parent), Some(parent_rel));
 
                     for (no, arg) in args.iter().enumerate() {
-                        self.add_expression(arg, Some(func), ns, parent, format!("arg #{}", no));
+                        self.add_expression(arg, Some(func), ns, parent, format!("arg #{no}"));
                     }
                 }
                 Statement::TryCatch(loc, _, try_catch) => {
@@ -1615,7 +1615,7 @@ impl Dot {
                         self.add_node(Node::new("try", labels), Some(parent), Some(parent_rel));
 
                     for (no, (_, param)) in try_catch.returns.iter().enumerate() {
-                        let parent_rel = format!("return #{}", no);
+                        let parent_rel = format!("return #{no}");
 
                         self.add_node(
                             Node::new(
@@ -1709,7 +1709,7 @@ impl Dot {
                         local_parent = self.add_yul_statement(
                             item,
                             local_parent,
-                            format!("statement #{}", item_no),
+                            format!("statement #{item_no}"),
                             &func.symtable,
                             ns,
                         );
@@ -1751,7 +1751,7 @@ impl Dot {
             local_parent = self.add_node(
                 Node::new("yul_function_parameter", labels),
                 Some(local_parent),
-                Some(format!("parameter #{}", item_no)),
+                Some(format!("parameter #{item_no}")),
             );
         }
 
@@ -1768,7 +1768,7 @@ impl Dot {
             local_parent = self.add_node(
                 Node::new("yul_function_return", labels),
                 Some(local_parent),
-                Some(format!("return #{}", item_no)),
+                Some(format!("return #{item_no}")),
             );
         }
 
@@ -1777,7 +1777,7 @@ impl Dot {
             local_parent = self.add_yul_statement(
                 item,
                 local_parent,
-                format!("statement #{}", item_no),
+                format!("statement #{item_no}"),
                 &ns.yul_functions[func_no].symtable,
                 ns,
             );
@@ -1994,7 +1994,7 @@ impl Dot {
                             ],
                         ),
                         Some(node),
-                        Some(format!("decl item #{}", decl_no)),
+                        Some(format!("decl item #{decl_no}")),
                     );
                 }
 
@@ -2014,7 +2014,7 @@ impl Dot {
                 );
 
                 for (item_no, item) in lhs.iter().enumerate() {
-                    self.add_yul_expression(item, symtable, ns, node, format!("rhs #{}", item_no));
+                    self.add_yul_expression(item, symtable, ns, node, format!("rhs #{item_no}"));
                 }
 
                 self.add_yul_expression(rhs, symtable, ns, node, "lhs".to_string());
@@ -2050,7 +2050,7 @@ impl Dot {
                             vec!["yul switch case".to_string(), ns.loc_to_string(&item.loc)],
                         ),
                         Some(node),
-                        Some(format!("case #{}", item_no)),
+                        Some(format!("case #{item_no}")),
                     );
                     self.add_yul_expression(
                         &item.condition,
@@ -2154,7 +2154,7 @@ impl Dot {
             parent = self.add_yul_statement(
                 child_statement,
                 parent,
-                format!("statement #{}", statement_no),
+                format!("statement #{statement_no}"),
                 symtable,
                 ns,
             );
@@ -2185,7 +2185,7 @@ impl Dot {
         );
 
         for (arg_no, arg) in args.iter().enumerate() {
-            self.add_yul_expression(arg, symtable, ns, node, format!("arg #{}", arg_no));
+            self.add_yul_expression(arg, symtable, ns, node, format!("arg #{arg_no}"));
         }
 
         node
@@ -2213,7 +2213,7 @@ impl Dot {
         );
 
         for (arg_no, arg) in args.iter().enumerate() {
-            self.add_yul_expression(arg, symtable, ns, node, format!("arg #{}", arg_no));
+            self.add_yul_expression(arg, symtable, ns, node, format!("arg #{arg_no}"));
         }
 
         node
@@ -2236,12 +2236,12 @@ impl Namespace {
                 let mut labels = decl
                     .values
                     .iter()
-                    .map(|(name, _)| format!("value: {}", name))
+                    .map(|(name, _)| format!("value: {name}"))
                     .collect::<Vec<String>>();
 
                 labels.insert(0, self.loc_to_string(&decl.loc));
                 if let Some(contract) = &decl.contract {
-                    labels.insert(0, format!("contract: {}", contract));
+                    labels.insert(0, format!("contract: {contract}"));
                 }
                 labels.insert(0, format!("name: {}", decl.name));
 
@@ -2263,7 +2263,7 @@ impl Namespace {
                         vec![format!("name:{}", decl.name), self.loc_to_string(&decl.loc)];
 
                     if let Some(contract) = &decl.contract {
-                        labels.insert(1, format!("contract: {}", contract));
+                        labels.insert(1, format!("contract: {contract}"));
                     }
 
                     for field in &decl.fields {
@@ -2291,7 +2291,7 @@ impl Namespace {
                 let mut labels = vec![format!("name:{}", decl.name), self.loc_to_string(&decl.loc)];
 
                 if let Some(contract) = &decl.contract {
-                    labels.insert(1, format!("contract: {}", contract));
+                    labels.insert(1, format!("contract: {contract}"));
                 }
 
                 if decl.anonymous {
@@ -2326,7 +2326,7 @@ impl Namespace {
                 ];
 
                 if let Some(contract) = &decl.contract {
-                    labels.insert(1, format!("contract: {}", contract));
+                    labels.insert(1, format!("contract: {contract}"));
                 }
 
                 let e = Node::new(&decl.name, labels);
@@ -2382,7 +2382,7 @@ impl Namespace {
 
                 if let Some((_, args)) = &base.constructor {
                     for (no, arg) in args.iter().enumerate() {
-                        dot.add_expression(arg, None, self, node, format!("arg #{}", no));
+                        dot.add_expression(arg, None, self, node, format!("arg #{no}"));
                     }
                 }
             }

+ 11 - 11
src/sema/eval.rs

@@ -106,7 +106,7 @@ pub fn eval_const_number(
                 None => {
                     return Err(Diagnostic::error(
                         expr.loc(),
-                        format!("cannot left shift by {}", r),
+                        format!("cannot left shift by {r}"),
                     ));
                 }
             };
@@ -122,7 +122,7 @@ pub fn eval_const_number(
                 None => {
                     return Err(Diagnostic::error(
                         expr.loc(),
-                        format!("cannot right shift by {}", r),
+                        format!("cannot right shift by {r}"),
                     ));
                 }
             };
@@ -450,11 +450,11 @@ fn eval_constants_in_expression(
             loc,
             ty,
             unchecked: _,
-            base: left,
-            exp: right,
+            base,
+            exp,
         } => {
-            let left = eval_constants_in_expression(left, ns).0;
-            let right = eval_constants_in_expression(right, ns).0;
+            let base = eval_constants_in_expression(base, ns).0;
+            let exp = eval_constants_in_expression(exp, ns).0;
 
             if let (
                 Some(Expression::NumberLiteral { value: left, .. }),
@@ -463,12 +463,12 @@ fn eval_constants_in_expression(
                     value: right,
                     ..
                 }),
-            ) = (&left, &right)
+            ) = (&base, &exp)
             {
                 if overflow_check(right, &Type::Uint(16), right_loc).is_some() {
                     ns.diagnostics.push(Diagnostic::error(
                         *right_loc,
-                        format!("power by {} is not possible", right),
+                        format!("power by {right} is not possible"),
                     ));
                     (None, false)
                 } else {
@@ -506,14 +506,14 @@ fn eval_constants_in_expression(
                 if overflow_check(right, &Type::Uint(64), right_loc).is_some() {
                     ns.diagnostics.push(Diagnostic::error(
                         *right_loc,
-                        format!("left shift by {} is not possible", right),
+                        format!("left shift by {right} is not possible"),
                     ));
                     (None, false)
                 } else {
                     if right >= &BigInt::from(left.bits()) {
                         ns.diagnostics.push(Diagnostic::warning(
                             *right_loc,
-                            format!("left shift by {} may overflow the final result", right),
+                            format!("left shift by {right} may overflow the final result"),
                         ));
                     }
 
@@ -553,7 +553,7 @@ fn eval_constants_in_expression(
                 if overflow_check(right, &Type::Uint(64), right_loc).is_some() {
                     ns.diagnostics.push(Diagnostic::error(
                         *right_loc,
-                        format!("right shift by {} is not possible", right),
+                        format!("right shift by {right} is not possible"),
                     ));
                     (None, false)
                 } else {

+ 1 - 2
src/sema/expression/constructor.rs

@@ -322,8 +322,7 @@ pub fn constructor_named_args(
             errors.push(Diagnostic::cast_error_with_note(
                 *loc,
                 format!(
-                    "constructor cannot be called with named arguments as {} of its parameters do not have names",
-                    unnamed_params,
+                    "constructor cannot be called with named arguments as {unnamed_params} of its parameters do not have names"
                 ),
                 func.loc,
                 format!("definition of {}", func.ty),

+ 3 - 5
src/sema/expression/function_call.rs

@@ -360,7 +360,7 @@ pub fn function_call_pos_args(
         _ => {
             diagnostics.push(Diagnostic::error(
                 *loc,
-                format!("cannot find overloaded {} which matches signature", func_ty),
+                format!("cannot find overloaded {func_ty} which matches signature"),
             ));
         }
     }
@@ -421,8 +421,7 @@ pub(super) fn function_call_named_args(
             errors.push(Diagnostic::cast_error_with_note(
                 *loc,
                 format!(
-                    "function cannot be called with named arguments as {} of its parameters do not have names",
-                    unnamed_params,
+                    "function cannot be called with named arguments as {unnamed_params} of its parameters do not have names"
                 ),
                 func.loc,
                 format!("definition of {}", func.name),
@@ -1607,8 +1606,7 @@ pub(super) fn method_call_named_args(
                 errors.push(Diagnostic::cast_error_with_note(
                     *loc,
                     format!(
-                        "function cannot be called with named arguments as {} of its parameters do not have names",
-                        unnamed_params,
+                        "function cannot be called with named arguments as {unnamed_params} of its parameters do not have names"
                     ),
                     func.loc,
                     format!("definition of {}", func.name),

+ 2 - 2
src/sema/expression/integers.rs

@@ -205,7 +205,7 @@ pub fn bigint_to_expression(
 
     if n.sign() == Sign::Minus {
         if bits > 255 {
-            diagnostics.push(Diagnostic::error(*loc, format!("{} is too large", n)));
+            diagnostics.push(Diagnostic::error(*loc, format!("{n} is too large")));
             Err(())
         } else {
             Ok(Expression::NumberLiteral {
@@ -215,7 +215,7 @@ pub fn bigint_to_expression(
             })
         }
     } else if bits > 256 {
-        diagnostics.push(Diagnostic::error(*loc, format!("{} is too large", n)));
+        diagnostics.push(Diagnostic::error(*loc, format!("{n} is too large")));
         Err(())
     } else {
         Ok(Expression::NumberLiteral {

+ 10 - 14
src/sema/expression/literals.rs

@@ -150,10 +150,7 @@ pub(crate) fn hex_number_literal(
             } else {
                 diagnostics.push(Diagnostic::error(
                     *loc,
-                    format!(
-                        "address literal has incorrect checksum, expected '{}'",
-                        address
-                    ),
+                    format!("address literal has incorrect checksum, expected '{address}'"),
                 ));
                 Err(())
             };
@@ -182,8 +179,7 @@ pub(crate) fn hex_number_literal(
             diagnostics.push(Diagnostic::cast_error(
                 *loc,
                 format!(
-                    "hex literal {} must be {} digits for type 'bytes{}'",
-                    n, expected_length, length,
+                    "hex literal {n} must be {expected_length} digits for type 'bytes{length}'"
                 ),
             ));
             Err(())
@@ -238,7 +234,7 @@ pub(super) fn address_literal(
                 if v[ns.address_length + 1] != hash[0] || v[ns.address_length + 2] != hash[1] {
                     diagnostics.push(Diagnostic::error(
                         *loc,
-                        format!("address literal {} hash incorrect checksum", address,),
+                        format!("address literal {address} hash incorrect checksum"),
                     ));
                     return Err(());
                 }
@@ -252,7 +248,7 @@ pub(super) fn address_literal(
             Err(FromBase58Error::InvalidBase58Length) => {
                 diagnostics.push(Diagnostic::error(
                     *loc,
-                    format!("address literal {} invalid base58 length", address),
+                    format!("address literal {address} invalid base58 length"),
                 ));
                 Err(())
             }
@@ -264,7 +260,7 @@ pub(super) fn address_literal(
                 }
                 diagnostics.push(Diagnostic::error(
                     loc,
-                    format!("address literal {} invalid character '{}'", address, ch),
+                    format!("address literal {address} invalid character '{ch}'"),
                 ));
                 Err(())
             }
@@ -293,7 +289,7 @@ pub(super) fn address_literal(
             Err(FromBase58Error::InvalidBase58Length) => {
                 diagnostics.push(Diagnostic::error(
                     *loc,
-                    format!("address literal {} invalid base58 length", address),
+                    format!("address literal {address} invalid base58 length"),
                 ));
                 Err(())
             }
@@ -305,7 +301,7 @@ pub(super) fn address_literal(
                 }
                 diagnostics.push(Diagnostic::error(
                     loc,
-                    format!("address literal {} invalid character '{}'", address, ch),
+                    format!("address literal {address} invalid character '{ch}'"),
                 ));
                 Err(())
             }
@@ -352,7 +348,7 @@ pub(crate) fn number_literal(
             } else {
                 diagnostics.push(Diagnostic::error(
                     *loc,
-                    format!("exponent '{}' too large", exp),
+                    format!("exponent '{exp}' too large"),
                 ));
                 return Err(());
             }
@@ -361,7 +357,7 @@ pub(crate) fn number_literal(
         } else {
             diagnostics.push(Diagnostic::error(
                 *loc,
-                format!("exponent '{}' too large", exp),
+                format!("exponent '{exp}' too large"),
             ));
             return Err(());
         }
@@ -410,7 +406,7 @@ pub(super) fn rational_number_literal(
         } else {
             diagnostics.push(Diagnostic::error(
                 *loc,
-                format!("exponent '{}' too large", exp),
+                format!("exponent '{exp}' too large"),
             ));
             return Err(());
         };

+ 13 - 15
src/sema/expression/mod.rs

@@ -160,7 +160,7 @@ impl Expression {
 
         // Special case: when converting literal sign can change if it fits
         match (self, &from, to) {
-            (&Expression::NumberLiteral { ref value, .. }, p, &Type::Uint(to_len))
+            (Expression::NumberLiteral { value, .. }, p, &Type::Uint(to_len))
                 if p.is_primitive() =>
             {
                 return if value.sign() == Sign::Minus {
@@ -203,7 +203,7 @@ impl Expression {
                     })
                 };
             }
-            (&Expression::NumberLiteral { ref value, .. }, p, &Type::Int(to_len))
+            (Expression::NumberLiteral { value, .. }, p, &Type::Int(to_len))
                 if p.is_primitive() =>
             {
                 return if value.bits() >= to_len as u64 {
@@ -224,7 +224,7 @@ impl Expression {
                     })
                 };
             }
-            (&Expression::NumberLiteral { ref value, .. }, p, &Type::Bytes(to_len))
+            (Expression::NumberLiteral { value, .. }, p, &Type::Bytes(to_len))
                 if p.is_primitive() =>
             {
                 // round up the number of bits to bytes
@@ -256,7 +256,7 @@ impl Expression {
                     })
                 };
             }
-            (&Expression::NumberLiteral { ref value, .. }, p, &Type::Address(payable))
+            (Expression::NumberLiteral { value, .. }, p, &Type::Address(payable))
                 if p.is_primitive() =>
             {
                 // note: negative values are allowed
@@ -284,7 +284,7 @@ impl Expression {
                 };
             }
             // Literal strings can be implicitly lengthened
-            (&Expression::BytesLiteral { ref value, .. }, p, &Type::Bytes(to_len))
+            (Expression::BytesLiteral { value, .. }, p, &Type::Bytes(to_len))
                 if p.is_primitive() =>
             {
                 return if value.len() > to_len as usize && implicit {
@@ -310,20 +310,20 @@ impl Expression {
                     })
                 };
             }
-            (&Expression::BytesLiteral { loc, ref value, .. }, _, &Type::DynamicBytes)
-            | (&Expression::BytesLiteral { loc, ref value, .. }, _, &Type::String) => {
+            (Expression::BytesLiteral { loc, value, .. }, _, &Type::DynamicBytes)
+            | (Expression::BytesLiteral { loc, value, .. }, _, &Type::String) => {
                 return Ok(Expression::AllocDynamicBytes {
-                    loc,
+                    loc: *loc,
                     ty: to.clone(),
                     length: Box::new(Expression::NumberLiteral {
-                        loc,
+                        loc: *loc,
                         ty: Type::Uint(32),
                         value: BigInt::from(value.len()),
                     }),
                     init: Some(value.clone()),
                 });
             }
-            (&Expression::NumberLiteral { ref value, .. }, _, &Type::Rational) => {
+            (Expression::NumberLiteral { value, .. }, _, &Type::Rational) => {
                 return Ok(Expression::RationalNumberLiteral {
                     loc: *loc,
                     ty: Type::Rational,
@@ -332,7 +332,7 @@ impl Expression {
             }
 
             (
-                &Expression::ArrayLiteral { .. },
+                Expression::ArrayLiteral { .. },
                 Type::Array(from_ty, from_dims),
                 Type::Array(to_ty, to_dims),
             ) => {
@@ -1205,8 +1205,7 @@ impl Expression {
                         diagnostics.push(Diagnostic::warning(
                             *loc,
                             format!(
-                                "function selector should only be casted to bytes{} or larger",
-                                selector_length
+                                "function selector should only be casted to bytes{selector_length} or larger"
                             ),
                         ));
                     }
@@ -1226,8 +1225,7 @@ impl Expression {
                     diagnostics.push(Diagnostic::warning(
                         *loc,
                         format!(
-                            "function selector needs an integer of at least {} bits to avoid being truncated",
-                            selector_width
+                            "function selector needs an integer of at least {selector_width} bits to avoid being truncated"
                         ),
                     ));
                 }

+ 1 - 1
src/sema/expression/strings.rs

@@ -72,7 +72,7 @@ pub(crate) fn unescape(
             Some((i, ch)) => {
                 diagnostics.push(Diagnostic::error(
                     pt::Loc::File(file_no, start + i, start + i + ch.len_utf8()),
-                    format!("unknown escape character '{}'", ch),
+                    format!("unknown escape character '{ch}'"),
                 ));
             }
             None => unreachable!(),

+ 3 - 3
src/sema/format.rs

@@ -174,7 +174,7 @@ fn parse_format_specifier(
                 Some((loc, ch)) => {
                     diagnostics.push(Diagnostic::error(
                         loc,
-                        format!("unexpected format char '{}'", ch),
+                        format!("unexpected format char '{ch}'"),
                     ));
                     return Err(());
                 }
@@ -192,7 +192,7 @@ fn parse_format_specifier(
                 Some((loc, ch)) => {
                     diagnostics.push(Diagnostic::error(
                         loc,
-                        format!("unexpected format char '{:}', expected closing '}}'", ch),
+                        format!("unexpected format char '{ch}', expected closing '}}'"),
                     ));
                     Err(())
                 }
@@ -208,7 +208,7 @@ fn parse_format_specifier(
         Some((loc, ch)) => {
             diagnostics.push(Diagnostic::error(
                 loc,
-                format!("unexpected format char '{}'", ch),
+                format!("unexpected format char '{ch}'"),
             ));
             Err(())
         }

+ 14 - 17
src/sema/functions.rs

@@ -126,9 +126,9 @@ pub fn contract_function(
                 if let Some(e) = &mutability {
                     ns.diagnostics.push(Diagnostic::error_with_note(
                         m.loc(),
-                        format!("function redeclared '{}'", m),
+                        format!("function redeclared '{m}'"),
                         e.loc(),
-                        format!("location of previous declaration of '{}'", e),
+                        format!("location of previous declaration of '{e}'"),
                     ));
                     success = false;
                     continue;
@@ -149,9 +149,9 @@ pub fn contract_function(
                 if let Some(e) = &visibility {
                     ns.diagnostics.push(Diagnostic::error_with_note(
                         v.loc().unwrap(),
-                        format!("function redeclared '{}'", v),
+                        format!("function redeclared '{v}'"),
                         e.loc().unwrap(),
-                        format!("location of previous declaration of '{}'", e),
+                        format!("location of previous declaration of '{e}'"),
                     ));
                     success = false;
                     continue;
@@ -195,7 +195,7 @@ pub fn contract_function(
                         if list.contains(&no) {
                             diagnostics.push(Diagnostic::error(
                                 name.loc,
-                                format!("function duplicate override '{}'", name),
+                                format!("function duplicate override '{name}'"),
                             ));
                         } else if !is_base(no, contract_no, ns) {
                             diagnostics.push(Diagnostic::error(
@@ -238,14 +238,14 @@ pub fn contract_function(
             if func.ty == pt::FunctionTy::Modifier {
                 ns.diagnostics.push(Diagnostic::error(
                     v.loc().unwrap(),
-                    format!("'{}': modifiers can not have visibility", v),
+                    format!("'{v}': modifiers can not have visibility"),
                 ));
 
                 pt::Visibility::Internal(v.loc())
             } else if func.ty == pt::FunctionTy::Constructor {
                 ns.diagnostics.push(Diagnostic::warning(
                     v.loc().unwrap(),
-                    format!("'{}': visibility for constructors is ignored", v),
+                    format!("'{v}': visibility for constructors is ignored"),
                 ));
 
                 pt::Visibility::Public(v.loc())
@@ -674,9 +674,9 @@ pub fn function(
                 if let Some(e) = &mutability {
                     ns.diagnostics.push(Diagnostic::error_with_note(
                         m.loc(),
-                        format!("function redeclared '{}'", m),
+                        format!("function redeclared '{m}'"),
                         e.loc(),
-                        format!("location of previous declaration of '{}'", e),
+                        format!("location of previous declaration of '{e}'"),
                     ));
                     success = false;
                     continue;
@@ -696,10 +696,7 @@ pub fn function(
             pt::FunctionAttribute::Visibility(v) => {
                 ns.diagnostics.push(Diagnostic::error(
                     v.loc().unwrap(),
-                    format!(
-                        "'{}': only functions in contracts can have a visibility specifier",
-                        v
-                    ),
+                    format!("'{v}': only functions in contracts can have a visibility specifier"),
                 ));
                 success = false;
             }
@@ -871,8 +868,8 @@ pub fn resolve_params(
                     if let Some(storage) = &p.storage {
                         diagnostics.push(Diagnostic::error(
                             storage.loc(),
-                                format!("data location '{}' can only be specified for array, struct or mapping",
-                                storage)
+                                format!("data location '{storage}' can only be specified for array, struct or mapping"
+                                )
                             ));
                         success = false;
                     }
@@ -977,8 +974,8 @@ pub fn resolve_returns(
                     if let Some(storage) = &r.storage {
                         diagnostics.push(Diagnostic::error(
                             storage.loc(),
-                                format!("data location '{}' can only be specified for array, struct or mapping",
-                                storage)
+                                format!("data location '{storage}' can only be specified for array, struct or mapping"
+                                )
                             ));
                         success = false;
                     }

+ 1 - 1
src/sema/mod.rs

@@ -519,7 +519,7 @@ fn annotions_not_allowed(annotations: &[&pt::Annotation], item: &str, ns: &mut a
     for note in annotations {
         ns.diagnostics.push(ast::Diagnostic::error(
             note.loc,
-            format!("annotations not allowed on {}", item),
+            format!("annotations not allowed on {item}"),
         ));
     }
 }

+ 7 - 9
src/sema/namespace.rs

@@ -783,8 +783,7 @@ impl Namespace {
                         return Err(());
                     } else if is_substrate && n > &u32::MAX.into() {
                         let msg = format!(
-                            "array dimension of {} exceeds the maximum of 4294967295 on Substrate",
-                            n
+                            "array dimension of {n} exceeds the maximum of 4294967295 on Substrate"
                         );
                         diagnostics.push(Diagnostic::decl_error(*loc, msg));
                         return Err(());
@@ -850,11 +849,10 @@ impl Namespace {
                                 if let Some(e) = &mutability {
                                     diagnostics.push(Diagnostic::error_with_note(
                                         m.loc(),
-                                        format!("function type mutability redeclared '{}'", m),
+                                        format!("function type mutability redeclared '{m}'"),
                                         e.loc(),
                                         format!(
-                                            "location of previous mutability declaration of '{}'",
-                                            e
+                                            "location of previous mutability declaration of '{e}'"
                                         ),
                                     ));
                                     success = false;
@@ -881,7 +879,7 @@ impl Namespace {
                             pt::FunctionAttribute::Visibility(v) => {
                                 diagnostics.push(Diagnostic::error(
                                     v.loc().unwrap(),
-                                    format!("function type cannot have visibility '{}'", v),
+                                    format!("function type cannot have visibility '{v}'"),
                                 ));
                                 success = false;
                             }
@@ -901,7 +899,7 @@ impl Namespace {
                         Some(v) => {
                             diagnostics.push(Diagnostic::error(
                                 v.loc().unwrap(),
-                                format!("function type cannot have visibility attribute '{}'", v),
+                                format!("function type cannot have visibility attribute '{v}'"),
                             ));
                             success = false;
                             false
@@ -945,14 +943,14 @@ impl Namespace {
                             pt::FunctionAttribute::Mutability(m) => {
                                 diagnostics.push(Diagnostic::error(
                                     m.loc(),
-                                    format!("mutability '{}' cannot be declared after returns", m),
+                                    format!("mutability '{m}' cannot be declared after returns"),
                                 ));
                                 success = false;
                             }
                             pt::FunctionAttribute::Visibility(v) => {
                                 diagnostics.push(Diagnostic::error(
                                     v.loc().unwrap(),
-                                    format!("function type cannot have visibility '{}'", v),
+                                    format!("function type cannot have visibility '{v}'"),
                                 ));
                                 success = false;
                             }

+ 8 - 21
src/sema/statements.rs

@@ -702,10 +702,7 @@ fn statement(
             if symtable.returns.len() != no_returns {
                 ns.diagnostics.push(Diagnostic::error(
                     *loc,
-                    format!(
-                        "missing return value, {} return values expected",
-                        no_returns
-                    ),
+                    format!("missing return value, {no_returns} return values expected"),
                 ));
                 return Err(());
             }
@@ -884,7 +881,7 @@ fn statement(
             if let Some(error) = error {
                 ns.diagnostics.push(Diagnostic::error(
                     error.loc,
-                    format!("revert with custom error '{}' not supported yet", error),
+                    format!("revert with custom error '{error}' not supported yet"),
                 ));
                 return Err(());
             }
@@ -1094,8 +1091,7 @@ fn emit_event(
                     temp_diagnostics.push(Diagnostic::cast_error_with_note(
                         *loc,
                         format!(
-                            "event cannot be emmited with named fields as {} of its fields do not have names",
-                            unnamed_fields,
+                            "event cannot be emmited with named fields as {unnamed_fields} of its fields do not have names"
                         ),
                         event.loc,
                         format!("definition of {}", event.name),
@@ -1235,7 +1231,7 @@ fn destructure(
                 if let Some(storage) = storage {
                     diagnostics.push(Diagnostic::error(
                         storage.loc(),
-                        format!("storage modifier '{}' not permitted on assignment", storage),
+                        format!("storage modifier '{storage}' not permitted on assignment"),
                     ));
                     return Err(());
                 }
@@ -1538,10 +1534,7 @@ fn resolve_var_decl_ty(
         if !var_ty.can_have_data_location() {
             diagnostics.push(Diagnostic::error(
                 storage.loc(),
-                format!(
-                    "data location '{}' only allowed for array, struct or mapping type",
-                    storage
-                ),
+                format!("data location '{storage}' only allowed for array, struct or mapping type"),
             ));
             return Err(());
         }
@@ -1649,10 +1642,7 @@ fn return_with_values(
             if no_returns > 0 && returns.is_empty() {
                 diagnostics.push(Diagnostic::error(
                     *loc,
-                    format!(
-                        "missing return value, {} return values expected",
-                        no_returns
-                    ),
+                    format!("missing return value, {no_returns} return values expected"),
                 ));
                 return Err(());
             }
@@ -1721,10 +1711,7 @@ fn return_with_values(
     if no_returns > 0 && expr_return_tys.is_empty() {
         diagnostics.push(Diagnostic::error(
             *loc,
-            format!(
-                "missing return value, {} return values expected",
-                no_returns
-            ),
+            format!("missing return value, {no_returns} return values expected"),
         ));
         return Err(());
     }
@@ -2139,7 +2126,7 @@ fn try_catch(
                 if name.is_empty() {
                     "duplicate catch clause".to_string()
                 } else {
-                    format!("duplicate '{}' catch clause", name)
+                    format!("duplicate '{name}' catch clause")
                 },
             ));
             return Err(());

+ 3 - 3
src/sema/tags.rs

@@ -52,7 +52,7 @@ pub fn resolve_tags(
                     if res.iter().any(|e| e.tag == "param" && e.no == no) {
                         ns.diagnostics.push(Diagnostic::error(
                             tag_loc,
-                            format!("duplicate tag '@param' for '{}'", name),
+                            format!("duplicate tag '@param' for '{name}'"),
                         ));
                     } else {
                         res.push(Tag {
@@ -65,7 +65,7 @@ pub fn resolve_tags(
                 } else {
                     ns.diagnostics.push(Diagnostic::error(
                         value_loc,
-                        format!("tag '@param' no field '{}'", name),
+                        format!("tag '@param' no field '{name}'"),
                     ));
                 }
             }
@@ -110,7 +110,7 @@ pub fn resolve_tags(
                         if res.iter().any(|e| e.tag == "return" && e.no == no) {
                             ns.diagnostics.push(Diagnostic::error(
                                 tag_loc,
-                                format!("duplicate tag '@return' for '{}'", name),
+                                format!("duplicate tag '@return' for '{name}'"),
                             ));
                         } else {
                             res.push(Tag {

+ 16 - 19
src/sema/types.rs

@@ -450,7 +450,7 @@ fn contract_annotations(
                     Err(FromBase58Error::InvalidBase58Length) => {
                         ns.diagnostics.push(Diagnostic::error(
                             loc,
-                            format!("address literal {} invalid base58 length", string),
+                            format!("address literal {string} invalid base58 length"),
                         ));
                     }
                     Err(FromBase58Error::InvalidBase58Character(ch, pos)) => {
@@ -460,7 +460,7 @@ fn contract_annotations(
                         }
                         ns.diagnostics.push(Diagnostic::error(
                             loc,
-                            format!("address literal {} invalid character '{}'", string, ch),
+                            format!("address literal {string} invalid character '{ch}'"),
                         ));
                     }
                 }
@@ -527,10 +527,7 @@ pub fn struct_decl(
         if let Some(storage) = &field.storage {
             ns.diagnostics.push(Diagnostic::error(
                 storage.loc(),
-                format!(
-                    "storage location '{}' not allowed for struct field",
-                    storage
-                ),
+                format!("storage location '{storage}' not allowed for struct field"),
             ));
         }
 
@@ -870,11 +867,11 @@ impl Type {
             Type::Bool => "bool".to_string(),
             Type::Address(false) => "address".to_string(),
             Type::Address(true) => "address payable".to_string(),
-            Type::Int(n) => format!("int{}", n),
-            Type::Uint(n) => format!("uint{}", n),
+            Type::Int(n) => format!("int{n}"),
+            Type::Uint(n) => format!("uint{n}"),
             Type::Rational => "rational".to_string(),
             Type::Value => format!("uint{}", ns.value_length * 8),
-            Type::Bytes(n) => format!("bytes{}", n),
+            Type::Bytes(n) => format!("bytes{n}"),
             Type::String => "string".to_string(),
             Type::DynamicBytes => "bytes".to_string(),
             Type::Enum(n) => format!("enum {}", ns.enums[*n]),
@@ -884,7 +881,7 @@ impl Type {
                 ty.to_string(ns),
                 len.iter()
                     .map(|len| match len {
-                        ArrayLength::Fixed(len) => format!("[{}]", len),
+                        ArrayLength::Fixed(len) => format!("[{len}]"),
                         _ => "[]".to_string(),
                     })
                     .collect::<String>()
@@ -915,7 +912,7 @@ impl Type {
                 );
 
                 if !mutability.is_default() {
-                    write!(s, " {}", mutability).unwrap();
+                    write!(s, " {mutability}").unwrap();
                 }
 
                 if !returns.is_empty() {
@@ -972,10 +969,10 @@ impl Type {
                 format!("bytes{}", ns.address_length)
             }
             Type::Contract(_) | Type::Address(_) => "address".to_string(),
-            Type::Int(n) => format!("int{}", n),
-            Type::Uint(n) => format!("uint{}", n),
+            Type::Int(n) => format!("int{n}"),
+            Type::Uint(n) => format!("uint{n}"),
             Type::Rational => "rational".to_string(),
-            Type::Bytes(n) => format!("bytes{}", n),
+            Type::Bytes(n) => format!("bytes{n}"),
             Type::DynamicBytes => "bytes".to_string(),
             Type::String => "string".to_string(),
             Type::Enum(n) => ns.enums[*n].ty.to_signature_string(say_tuple, ns),
@@ -984,7 +981,7 @@ impl Type {
                 ty.to_signature_string(say_tuple, ns),
                 len.iter()
                     .map(|len| match len {
-                        ArrayLength::Fixed(len) => format!("[{}]", len),
+                        ArrayLength::Fixed(len) => format!("[{len}]"),
                         _ => "[]".to_string(),
                     })
                     .collect::<String>()
@@ -1662,9 +1659,9 @@ impl Type {
         match self {
             Type::Bool => "bool".to_string(),
             Type::Address(_) => "address".to_string(),
-            Type::Int(n) => format!("int{}", n),
-            Type::Uint(n) => format!("uint{}", n),
-            Type::Bytes(n) => format!("bytes{}", n),
+            Type::Int(n) => format!("int{n}"),
+            Type::Uint(n) => format!("uint{n}"),
+            Type::Bytes(n) => format!("bytes{n}"),
             Type::DynamicBytes => "bytes".to_string(),
             Type::String => "string".to_string(),
             Type::Enum(i) => format!("{}", ns.enums[*i]),
@@ -1675,7 +1672,7 @@ impl Type {
                 len.iter()
                     .map(|r| match r {
                         ArrayLength::Dynamic | ArrayLength::AnyFixed => ":".to_string(),
-                        ArrayLength::Fixed(r) => format!(":{}", r),
+                        ArrayLength::Fixed(r) => format!(":{r}"),
                     })
                     .collect::<String>()
             ),

+ 6 - 6
src/sema/unused_variable.rs

@@ -11,19 +11,19 @@ pub fn assigned_variable(ns: &mut Namespace, exp: &Expression, symtable: &mut Sy
     match &exp {
         Expression::StorageVariable {
             contract_no,
-            var_no: offset,
+            var_no,
             ..
         } => {
-            ns.contracts[*contract_no].variables[*offset].assigned = true;
+            ns.contracts[*contract_no].variables[*var_no].assigned = true;
         }
 
-        Expression::Variable { var_no: offset, .. } => {
-            let var = symtable.vars.get_mut(offset).unwrap();
+        Expression::Variable { var_no, .. } => {
+            let var = symtable.vars.get_mut(var_no).unwrap();
             var.assigned = true;
         }
 
-        Expression::StructMember { expr: str, .. } => {
-            assigned_variable(ns, str, symtable);
+        Expression::StructMember { expr, .. } => {
+            assigned_variable(ns, expr, symtable);
         }
 
         Expression::Subscript { array, index, .. } => {

+ 7 - 7
src/sema/using.rs

@@ -26,7 +26,7 @@ pub(crate) fn using_decl(
             Ok(Type::Contract(contract_no)) if ns.contracts[contract_no].is_library() => {
                 ns.diagnostics.push(Diagnostic::error(
                     expr.loc(),
-                    format!("using for library '{}' type not permitted", expr),
+                    format!("using for library '{expr}' type not permitted"),
                 ));
                 return Err(());
             }
@@ -84,13 +84,13 @@ pub(crate) fn using_decl(
                             .iter()
                             .map(|(loc, _)| Note {
                                 loc: *loc,
-                                message: format!("definition of '{}'", function_name),
+                                message: format!("definition of '{function_name}'"),
                             })
                             .collect();
 
                         diagnostics.push(Diagnostic::error_with_notes(
                             function_name.loc,
-                            format!("'{}' is an overloaded function", function_name),
+                            format!("'{function_name}' is an overloaded function"),
                             notes,
                         ));
                         continue;
@@ -104,11 +104,11 @@ pub(crate) fn using_decl(
                         diagnostics.push(Diagnostic::error_with_note(
                             function_name.loc,
                             format!(
-                                "'{}' has no arguments, at least one argument required",
-                                function_name
+                                "'{function_name}' has no arguments, at least one argument required"
+
                             ),
                             loc,
-                            format!("definition of '{}'", function_name),
+                            format!("definition of '{function_name}'"),
                         ));
                         continue;
                     }
@@ -119,7 +119,7 @@ pub(crate) fn using_decl(
                                 function_name.loc,
                                 format!("function cannot be used since first argument is '{}' rather than the required '{}'", func.params[0].ty.to_string(ns), ty.to_string(ns)),
                                 loc,
-                                format!("definition of '{}'", function_name),
+                                format!("definition of '{function_name}'"),
                             ));
                             continue;
                         }

+ 5 - 8
src/sema/variables.rs

@@ -175,7 +175,7 @@ pub fn variable_decl<'a>(
                             if list.contains(&no) {
                                 diagnostics.push(Diagnostic::error(
                                     name.loc,
-                                    format!("duplicate override '{}'", name),
+                                    format!("duplicate override '{name}'"),
                                 ));
                             } else if !is_base(no, contract_no, ns) {
                                 diagnostics.push(Diagnostic::error(
@@ -204,7 +204,7 @@ pub fn variable_decl<'a>(
             pt::VariableAttribute::Visibility(v) if contract_no.is_none() => {
                 ns.diagnostics.push(Diagnostic::error(
                     v.loc().unwrap(),
-                    format!("'{}': global variable cannot have visibility specifier", v),
+                    format!("'{v}': global variable cannot have visibility specifier"),
                 ));
                 return None;
             }
@@ -219,9 +219,9 @@ pub fn variable_decl<'a>(
                 if let Some(e) = &visibility {
                     ns.diagnostics.push(Diagnostic::error_with_note(
                         v.loc().unwrap(),
-                        format!("variable visibility redeclared '{}'", v),
+                        format!("variable visibility redeclared '{v}'"),
                         e.loc().unwrap(),
-                        format!("location of previous declaration of '{}'", e),
+                        format!("location of previous declaration of '{e}'"),
                     ));
                     return None;
                 }
@@ -299,10 +299,7 @@ pub fn variable_decl<'a>(
     {
         ns.diagnostics.push(Diagnostic::error(
             def.ty.loc(),
-            format!(
-                "variable of type internal function cannot be '{}'",
-                visibility
-            ),
+            format!("variable of type internal function cannot be '{visibility}'"),
         ));
         return None;
     } else if let Some(ty) = ty.contains_builtins(ns, &StructType::AccountInfo) {

+ 5 - 9
src/sema/yul/expression.rs

@@ -148,7 +148,7 @@ fn resolve_number_literal(
             } else {
                 ns.diagnostics.push(Diagnostic::error(
                     *loc,
-                    format!("exponent '{}' too large", exp),
+                    format!("exponent '{exp}' too large"),
                 ));
                 return Err(());
             }
@@ -157,7 +157,7 @@ fn resolve_number_literal(
         } else {
             ns.diagnostics.push(Diagnostic::error(
                 *loc,
-                format!("exponent '{}' too large", exp),
+                format!("exponent '{exp}' too large"),
             ));
             return Err(());
         }
@@ -200,8 +200,7 @@ fn resolve_number_literal(
             ty: ErrorType::TypeError,
             loc: *loc,
             message: format!(
-                "the provided literal requires {} bits, but the type only supports {}",
-                bits_needed, type_size
+                "the provided literal requires {bits_needed} bits, but the type only supports {type_size}"
             ),
             notes: vec![],
         });
@@ -503,7 +502,7 @@ fn check_function_argument(
         if n1 < n2 {
             ns.diagnostics.push(Diagnostic::warning(
                 argument.loc(),
-                format!("{} bit type may not fit into {} bit type", n2, n1),
+                format!("{n2} bit type may not fit into {n1} bit type"),
             ));
         }
     } else if matches!(parameter.ty, Type::Uint(_)) && matches!(arg_type, Type::Int(_)) {
@@ -517,10 +516,7 @@ fn check_function_argument(
         if n1 == n2 {
             ns.diagnostics.push(Diagnostic::warning(
                 argument.loc(),
-                format!(
-                    "{} bit unsigned integer may not fit into {} bit signed integer",
-                    n1, n2
-                ),
+                format!("{n1} bit unsigned integer may not fit into {n2} bit signed integer"),
             ));
         }
     }

+ 3 - 3
tests/codegen.rs

@@ -131,12 +131,12 @@ fn testcase(path: PathBuf) {
     }
 
     if current_check < checks.len() {
-        println!("{}", stderr);
-        println!("OUTPUT: \n===8<===8<===\n{}===8<===8<===\n", stdout);
+        println!("{stderr}");
+        println!("OUTPUT: \n===8<===8<===\n{stdout}===8<===8<===\n");
 
         panic!("NOT FOUND CHECK: {:?}", checks[current_check]);
     } else if current_fail < fails.len() {
-        println!("STDERR: \n===8<===8<===\n{}===8<===8<===\n", stderr);
+        println!("STDERR: \n===8<===8<===\n{stderr}===8<===8<===\n");
 
         panic!("NOT FOUND FAIL: {:?}", fails[current_check]);
     }

+ 1 - 1
tests/contract.rs

@@ -133,7 +133,7 @@ fn add_file(cache: &mut FileResolver, path: &Path, target: Target) -> io::Result
     // make sure the path uses unix file separators, this is what the dot file uses
     let filename = path.to_slash_lossy();
 
-    println!("Parsing {} for {}", filename, target);
+    println!("Parsing {filename} for {target}");
 
     // The files may have had their end of lines mangled on Windows
     cache.set_file_contents(&filename, source.replace("\r\n", "\n"));

+ 1 - 2
tests/doc_examples.rs

@@ -43,7 +43,6 @@ fn file_resolver(target: Target) -> FileResolver {
 fn get_source_files(dir: &str) -> Vec<String> {
     read_dir(dir)
         .unwrap()
-        .into_iter()
         .filter_map(|entry| {
             let e = entry.unwrap();
             if let (true, Some(ext)) = (e.path().is_file(), e.path().extension()) {
@@ -86,7 +85,7 @@ fn assert_compile(dir: &str, target: Target) {
     let errors = get_source_files(dir)
         .par_iter()
         .filter_map(|path| try_compile(path, target).err().map(|msg| (path, msg)))
-        .map(|(path, msg)| println!("{} failed: {:#?}", path, msg))
+        .map(|(path, msg)| println!("{path} failed: {msg:#?}"))
         .count();
     assert_eq!(0, errors);
 }

+ 4 - 4
tests/imports.rs

@@ -22,7 +22,7 @@ fn import_map_dup() {
     let output = dup.get_output();
     let stderr = String::from_utf8_lossy(&output.stderr);
 
-    println!("stderr: {}", stderr);
+    println!("stderr: {stderr}");
 
     assert_eq!(
         stderr,
@@ -48,7 +48,7 @@ fn import_map_badpath() {
     let output = badpath.get_output();
     let stderr = String::from_utf8_lossy(&output.stderr);
 
-    println!("stderr: {}", stderr);
+    println!("stderr: {stderr}");
 
     assert!(stderr.contains("error: import path '/does/not/exist': "));
 }
@@ -81,7 +81,7 @@ fn import_map() {
     let output = badpath.get_output();
     let stderr = String::from_utf8_lossy(&output.stderr);
 
-    println!("stderr: {}", stderr);
+    println!("stderr: {stderr}");
 
     assert!(stderr.contains("file not found 'foo/bar.sol'"));
 }
@@ -114,7 +114,7 @@ fn import() {
     let output = badpath.get_output();
     let stderr = String::from_utf8_lossy(&output.stderr);
 
-    println!("stderr: {}", stderr);
+    println!("stderr: {stderr}");
 
     assert!(stderr.contains("file not found 'bar.sol'"));
 }

+ 14 - 20
tests/solana.rs

@@ -415,10 +415,7 @@ impl<'a> SyscallContext<'a> {
             let allocated: u64 = read_u64(current_elem + 24);
 
             if VERBOSE {
-                println!(
-                    "next:{:08x} prev:{:08x} length:{} allocated:{}",
-                    next, prev, length, allocated
-                );
+                println!("next:{next:08x} prev:{prev:08x} length:{length} allocated:{allocated}");
             }
 
             let start = (current_elem + 8 * 4 - HEAP_START) as usize;
@@ -446,7 +443,7 @@ impl<'a> SyscallContext<'a> {
                             break;
                         }
                         let b = buf[offset + i];
-                        write!(hex, " {:02x}", b).unwrap();
+                        write!(hex, " {b:02x}").unwrap();
                         if b.is_ascii() && !b.is_ascii_control() {
                             write!(chars, "  {}", b as char).unwrap();
                         } else {
@@ -454,7 +451,7 @@ impl<'a> SyscallContext<'a> {
                         }
                     }
                     if VERBOSE {
-                        println!("{}\n{}", hex, chars);
+                        println!("{hex}\n{chars}");
                     }
                 }
             }
@@ -536,7 +533,7 @@ impl<'a> SyscallObject<UserError> for SolLog<'a> {
                 len as usize,
             ))
             .unwrap();
-            println!("log: {}", message);
+            println!("log: {message}");
             if let Ok(mut vm) = self.context.vm.try_borrow_mut() {
                 vm.logs.push_str(message);
             }
@@ -573,7 +570,7 @@ impl<'a> SyscallObject<UserError> for SolLogPubKey<'a> {
             result
         );
         let message = account[0].to_base58();
-        println!("log pubkey: {}", message);
+        println!("log pubkey: {message}");
         if let Ok(mut vm) = self.context.vm.try_borrow_mut() {
             vm.logs.push_str(&message);
         }
@@ -602,12 +599,9 @@ impl<'a> SyscallObject<UserError> for SolLogU64<'a> {
         _memory_mapping: &mut MemoryMapping,
         result: &mut Result<u64, EbpfError<UserError>>,
     ) {
-        let message = format!(
-            "{:#x}, {:#x}, {:#x}, {:#x}, {:#x}",
-            arg1, arg2, arg3, arg4, arg5
-        );
+        let message = format!("{arg1:#x}, {arg2:#x}, {arg3:#x}, {arg4:#x}, {arg5:#x}");
 
-        println!("log64: {}", message);
+        println!("log64: {message}");
 
         self.context.heap_verify();
 
@@ -869,7 +863,7 @@ impl<'a> SyscallObject<UserError> for SyscallSetReturnData<'a> {
     ) {
         self.context.heap_verify();
 
-        assert!(len <= 1024, "sol_set_return_data: length is {}", len);
+        assert!(len <= 1024, "sol_set_return_data: length is {len}");
 
         let buf = question_mark!(translate_slice::<u8>(memory_mapping, addr, len), result);
 
@@ -1419,7 +1413,7 @@ impl<'a> SyscallObject<UserError> for SyscallInvokeSignedC<'a> {
                             }
                         }
                     }
-                    instruction => panic!("instruction {} not supported", instruction),
+                    instruction => panic!("instruction {instruction} not supported"),
                 }
             } else {
                 let data_id: Account = instruction.accounts[0].pubkey.0;
@@ -1619,7 +1613,7 @@ impl VirtualMachine {
 
         let res = self.execute(&default_metas, &calldata);
 
-        println!("res:{:?}", res);
+        println!("res:{res:?}");
         assert_eq!(res, Ok(expected));
         if let Some((_, return_data)) = &self.return_data {
             assert_eq!(return_data.len(), 0);
@@ -1655,7 +1649,7 @@ impl VirtualMachine {
         {
             instr.clone()
         } else {
-            panic!("Function '{}' not found", name);
+            panic!("Function '{name}' not found");
         };
 
         let mut encoded_args = encode_arguments(args);
@@ -1666,8 +1660,8 @@ impl VirtualMachine {
         let res = self.execute(metas, &calldata);
         match res {
             Ok(0) => (),
-            Ok(error_code) => panic!("unexpected return {:#x}", error_code),
-            Err(e) => panic!("error: {:?}", e),
+            Ok(error_code) => panic!("unexpected return {error_code:#x}"),
+            Err(e) => panic!("error: {e:?}"),
         };
 
         let return_data = if let Some((_, return_data)) = &self.return_data {
@@ -1711,7 +1705,7 @@ impl VirtualMachine {
             .iter()
             .any(|item| item.name == name)
         {
-            panic!("Function '{}' not found", name);
+            panic!("Function '{name}' not found");
         }
 
         let selector = discriminator("global", name);

+ 5 - 5
tests/solana_tests/builtin.rs

@@ -145,7 +145,7 @@ fn pda() {
             "2fnQrngrQT4SeLcdToJAD96phoEjNL2man2kfRLCASVk"
         );
     } else {
-        panic!("{:?} not expected", returns);
+        panic!("{returns:?} not expected");
     }
 
     let returns = vm
@@ -158,7 +158,7 @@ fn pda() {
             "7YgSsrAiAEJFqBNujFBRsEossqdpV31byeJLBsZ5QSJE"
         );
     } else {
-        panic!("{:?} not expected", returns);
+        panic!("{returns:?} not expected");
     }
 
     let returns = vm
@@ -177,7 +177,7 @@ fn pda() {
             "2fnQrngrQT4SeLcdToJAD96phoEjNL2man2kfRLCASVk"
         );
     } else {
-        panic!("{:?} not expected", returns);
+        panic!("{returns:?} not expected");
     }
 
     let returns = vm
@@ -193,7 +193,7 @@ fn pda() {
             "DZpR2BwsPVtbXxUUbMx5tK58Ln2T9RUtAshtR2ePqDcu"
         );
     } else {
-        panic!("{:?} not expected", returns);
+        panic!("{returns:?} not expected");
     }
 
     let returns = vm
@@ -209,7 +209,7 @@ fn pda() {
             "3Y19WiAiLD8kT8APmtk41NgHEpkYTzx28s1uwAX8LJq4"
         );
     } else {
-        panic!("{:?} not expected", returns);
+        panic!("{returns:?} not expected");
     }
 }
 

+ 1 - 1
tests/solana_tests/create_contract.rs

@@ -132,7 +132,7 @@ fn simple_create_contract() {
 
     vm.logs.truncate(0);
 
-    println!("next test, {:?}", bar1);
+    println!("next test, {bar1:?}");
 
     vm.function(
         "call_bar1_at_address",

+ 1 - 1
tests/solana_tests/events.rs

@@ -98,7 +98,7 @@ fn less_simple_event() {
 }
 
 fn calculate_discriminator(event_name: &str) -> Vec<u8> {
-    let image = format!("event:{}", event_name);
+    let image = format!("event:{event_name}");
     let mut hasher = Sha256::new();
     hasher.update(image.as_bytes());
     let finalized = hasher.finalize();

+ 15 - 15
tests/solana_tests/primitives.rs

@@ -209,7 +209,7 @@ fn bytes() {
                 return a >> r;
             }
         }"#
-        .replace("bytesN", &format!("bytes{}", width));
+        .replace("bytesN", &format!("bytes{width}"));
 
         let mut vm = build_solidity(&src);
 
@@ -295,7 +295,7 @@ fn bytes() {
 
             let r = rng.gen::<u32>() % (width as u32 * 8);
 
-            println!("w = {} r = {}", width, r);
+            println!("w = {width} r = {r}");
 
             let shl = vm
                 .function(
@@ -406,13 +406,13 @@ fn uint() {
                 return a >> r;
             }
         }"#
-        .replace("uintN", &format!("uint{}", width));
+        .replace("uintN", &format!("uint{width}"));
 
         let mut vm = build_solidity(&src);
 
         vm.constructor(&[]);
 
-        println!("width:{}", width);
+        println!("width:{width}");
         let returned_width = width.next_power_of_two();
 
         for _ in 0..10 {
@@ -430,7 +430,7 @@ fn uint() {
                 }],
             );
 
-            println!("{:x} = {:?} o", a, res);
+            println!("{a:x} = {res:?} o");
 
             let add = vm
                 .function(
@@ -451,7 +451,7 @@ fn uint() {
             let mut res = a.clone().add(&b);
             truncate_biguint(&mut res, width);
 
-            println!("{:x} + {:x} = {:?} or {:x}", a, b, add, res);
+            println!("{a:x} + {b:x} = {add:?} or {res:x}");
 
             assert_eq!(
                 add,
@@ -768,7 +768,7 @@ fn test_power_overflow_boundaries() {
                 return a ** b;
             }
         }"#
-        .replace("intN", &format!("int{}", width));
+        .replace("intN", &format!("int{width}"));
 
         let mut contract = build_solidity_with_overflow_check(&src, true);
         contract.constructor(&[]);
@@ -826,7 +826,7 @@ fn test_overflow_boundaries() {
                 return a * b;
             }
         }"#
-        .replace("intN", &format!("int{}", width));
+        .replace("intN", &format!("int{width}"));
         let mut contract = build_solidity_with_overflow_check(&src, true);
 
         // The range of values that can be held in signed N bits is [-2^(N-1), 2^(N-1)-1]. We generate these boundaries:
@@ -990,18 +990,18 @@ fn test_mul_within_range_signed() {
                 return a * b;
             }
         }"#
-        .replace("intN", &format!("int{}", width));
+        .replace("intN", &format!("int{width}"));
 
         let mut contract = build_solidity(&src);
 
         // The range of values that can be held in signed N bits is [-2^(N-1), 2^(N-1)-1]. Here we generate a random number within this range and multiply it by -1, 1 or 0.
         let first_operand_rand = rng.gen_bigint(width - 1).sub(1_u32);
-        println!("First op : {:?}", first_operand_rand);
+        println!("First op : {first_operand_rand:?}");
 
         let side = vec![-1, 0, 1];
         // -1, 1 or 0
         let second_op = BigInt::from(*side.choose(&mut rng).unwrap());
-        println!("second op : {:?}", second_op);
+        println!("second op : {second_op:?}");
 
         contract.constructor(&[]);
         let return_value = contract
@@ -1041,7 +1041,7 @@ fn test_mul_within_range() {
                 return a * b;
             }
         }"#
-        .replace("intN", &format!("int{}", width));
+        .replace("intN", &format!("int{width}"));
 
         let mut contract = build_solidity_with_overflow_check(&src, true);
         contract.constructor(&[]);
@@ -1094,7 +1094,7 @@ fn test_overflow_detect_signed() {
                 return a * b;
             }
         }"#
-        .replace("intN", &format!("int{}", width));
+        .replace("intN", &format!("int{width}"));
         let mut contract = build_solidity_with_overflow_check(&src, true);
 
         contract.constructor(&[]);
@@ -1163,7 +1163,7 @@ fn test_overflow_detect_unsigned() {
                 return a * b;
             }
         }"#
-        .replace("intN", &format!("int{}", width));
+        .replace("intN", &format!("int{width}"));
         let mut contract = build_solidity_with_overflow_check(&src, true);
 
         contract.constructor(&[]);
@@ -1247,7 +1247,7 @@ fn int() {
                 return a >> r;
             }
         }"#
-        .replace("intN", &format!("int{}", width));
+        .replace("intN", &format!("int{width}"));
 
         let mut vm = build_solidity(&src);
 

+ 61 - 67
tests/substrate.rs

@@ -182,7 +182,7 @@ impl Externals for MockSubstrate {
                 );
 
                 if let Err(e) = self.vm.memory.set(dest_ptr, &self.vm.input) {
-                    panic!("seal_input: {}", e);
+                    panic!("seal_input: {e}");
                 }
 
                 self.vm
@@ -204,11 +204,11 @@ impl Externals for MockSubstrate {
                 let mut key: StorageKey = [0; 32];
 
                 if let Err(e) = self.vm.memory.get_into(key_ptr, &mut key) {
-                    panic!("seal_get_storage: {}", e);
+                    panic!("seal_get_storage: {e}");
                 }
 
                 if let Some(value) = self.store.get(&(self.vm.account, key)) {
-                    println!("seal_get_storage: {:?} = {:?}", key, value);
+                    println!("seal_get_storage: {key:?} = {value:?}");
 
                     let len = self
                         .vm
@@ -222,7 +222,7 @@ impl Externals for MockSubstrate {
                     );
 
                     if let Err(e) = self.vm.memory.set(dest_ptr, value) {
-                        panic!("seal_get_storage: {}", e);
+                        panic!("seal_get_storage: {e}");
                     }
 
                     self.vm
@@ -232,7 +232,7 @@ impl Externals for MockSubstrate {
 
                     Ok(Some(RuntimeValue::I32(0)))
                 } else {
-                    println!("seal_get_storage: {:?} = nil", key);
+                    println!("seal_get_storage: {key:?} = nil");
                     Ok(Some(RuntimeValue::I32(1)))
                 }
             }
@@ -244,10 +244,10 @@ impl Externals for MockSubstrate {
                 let mut key: StorageKey = [0; 32];
 
                 if let Err(e) = self.vm.memory.get_into(key_ptr, &mut key) {
-                    panic!("seal_clear_storage: {}", e);
+                    panic!("seal_clear_storage: {e}");
                 }
 
-                println!("seal_clear_storage: {:?}", key);
+                println!("seal_clear_storage: {key:?}");
                 let pre_existing_len = self
                     .store
                     .remove(&(self.vm.account, key))
@@ -268,16 +268,16 @@ impl Externals for MockSubstrate {
                 let mut key: StorageKey = [0; 32];
 
                 if let Err(e) = self.vm.memory.get_into(key_ptr, &mut key[..]) {
-                    panic!("seal_set_storage: {}", e);
+                    panic!("seal_set_storage: {e}");
                 }
 
                 let mut data = Vec::new();
                 data.resize(len as usize, 0u8);
 
                 if let Err(e) = self.vm.memory.get_into(data_ptr, &mut data) {
-                    panic!("seal_set_storage: {}", e);
+                    panic!("seal_set_storage: {e}");
                 }
-                println!("seal_set_storage: {:?} = {:?}", key, data);
+                println!("seal_set_storage: {key:?} = {data:?}");
 
                 let pre_existing_len = self
                     .store
@@ -297,7 +297,7 @@ impl Externals for MockSubstrate {
                 data.resize(len as usize, 0);
 
                 if let Err(e) = self.vm.memory.get_into(data_ptr, &mut data) {
-                    panic!("seal_hash_keccak_256: {}", e);
+                    panic!("seal_hash_keccak_256: {e}");
                 }
 
                 let mut hasher = Keccak::v256();
@@ -312,7 +312,7 @@ impl Externals for MockSubstrate {
                 );
 
                 if let Err(e) = self.vm.memory.set(out_ptr, &hash) {
-                    panic!("seal_hash_keccak_256: {}", e);
+                    panic!("seal_hash_keccak_256: {e}");
                 }
 
                 Ok(None)
@@ -327,7 +327,7 @@ impl Externals for MockSubstrate {
                 data.resize(len as usize, 0);
 
                 if let Err(e) = self.vm.memory.get_into(data_ptr, &mut data) {
-                    panic!("seal_hash_sha2_256: {}", e);
+                    panic!("seal_hash_sha2_256: {e}");
                 }
 
                 let mut hasher = Sha256::new();
@@ -342,7 +342,7 @@ impl Externals for MockSubstrate {
                 );
 
                 if let Err(e) = self.vm.memory.set(out_ptr, &hash) {
-                    panic!("seal_hash_sha2_256: {}", e);
+                    panic!("seal_hash_sha2_256: {e}");
                 }
 
                 Ok(None)
@@ -357,7 +357,7 @@ impl Externals for MockSubstrate {
                 data.resize(len as usize, 0);
 
                 if let Err(e) = self.vm.memory.get_into(data_ptr, &mut data) {
-                    panic!("seal_hash_blake2_128: {}", e);
+                    panic!("seal_hash_blake2_128: {e}");
                 }
                 let hash = blake2_rfc::blake2b::blake2b(16, &[], &data);
 
@@ -368,7 +368,7 @@ impl Externals for MockSubstrate {
                 );
 
                 if let Err(e) = self.vm.memory.set(out_ptr, hash.as_bytes()) {
-                    panic!("seal_hash_blake2_128: {}", e);
+                    panic!("seal_hash_blake2_128: {e}");
                 }
 
                 Ok(None)
@@ -383,7 +383,7 @@ impl Externals for MockSubstrate {
                 data.resize(len as usize, 0);
 
                 if let Err(e) = self.vm.memory.get_into(data_ptr, &mut data) {
-                    panic!("seal_hash_blake2_256: {}", e);
+                    panic!("seal_hash_blake2_256: {e}");
                 }
 
                 let hash = blake2_rfc::blake2b::blake2b(32, &[], &data);
@@ -395,7 +395,7 @@ impl Externals for MockSubstrate {
                 );
 
                 if let Err(e) = self.vm.memory.set(out_ptr, hash.as_bytes()) {
-                    panic!("seal_hash_blake2_256: {}", e);
+                    panic!("seal_hash_blake2_256: {e}");
                 }
 
                 Ok(None)
@@ -408,12 +408,12 @@ impl Externals for MockSubstrate {
                 self.vm.output.resize(len as usize, 0u8);
 
                 if let Err(e) = self.vm.memory.get_into(data_ptr, &mut self.vm.output) {
-                    panic!("seal_return: {}", e);
+                    panic!("seal_return: {e}");
                 }
 
                 match flags {
                     0 | 1 => Err(Trap::new(TrapKind::Host(Box::new(HostCodeReturn(flags))))),
-                    _ => panic!("seal_return flag {} not valid", flags),
+                    _ => panic!("seal_return flag {flags} not valid"),
                 }
             }
             Some(SubstrateExternal::seal_debug_message) => {
@@ -424,12 +424,12 @@ impl Externals for MockSubstrate {
                 buf.resize(len as usize, 0u8);
 
                 if let Err(e) = self.vm.memory.get_into(data_ptr, &mut buf) {
-                    panic!("seal_debug_message: {}", e);
+                    panic!("seal_debug_message: {e}");
                 }
 
                 let s = String::from_utf8(buf).expect("seal_debug_message: Invalid UFT8");
 
-                println!("seal_debug_message: {}", s);
+                println!("seal_debug_message: {s}");
 
                 self.printbuf.push_str(&s);
 
@@ -445,7 +445,7 @@ impl Externals for MockSubstrate {
                 buf.resize(len as usize, 0u8);
 
                 if let Err(e) = self.vm.memory.get_into(data_ptr, &mut buf) {
-                    panic!("seal_random: {}", e);
+                    panic!("seal_random: {e}");
                 }
 
                 let mut hash = [0u8; 32];
@@ -466,7 +466,7 @@ impl Externals for MockSubstrate {
                 );
 
                 if let Err(e) = self.vm.memory.set(dest_ptr, &hash) {
-                    panic!("seal_random: {}", e);
+                    panic!("seal_random: {e}");
                 }
 
                 self.vm
@@ -490,13 +490,13 @@ impl Externals for MockSubstrate {
                 let mut account = [0u8; 32];
 
                 if let Err(e) = self.vm.memory.get_into(account_ptr, &mut account) {
-                    panic!("seal_call: {}", e);
+                    panic!("seal_call: {e}");
                 }
 
                 let mut value = [0u8; 16];
 
                 if let Err(e) = self.vm.memory.get_into(value_ptr, &mut value) {
-                    panic!("seal_call: {}", e);
+                    panic!("seal_call: {e}");
                 }
 
                 let value = u128::from_le_bytes(value);
@@ -510,7 +510,7 @@ impl Externals for MockSubstrate {
                 input.resize(input_len as usize, 0u8);
 
                 if let Err(e) = self.vm.memory.get_into(input_ptr, &mut input) {
-                    panic!("seal_call: {}", e);
+                    panic!("seal_call: {e}");
                 }
 
                 println!(
@@ -545,7 +545,7 @@ impl Externals for MockSubstrate {
                         }
                     },
                     Ok(v) => v,
-                    Err(e) => panic!("fail to invoke call: {}", e),
+                    Err(e) => panic!("fail to invoke call: {e}"),
                 };
 
                 let output = self.vm.output.clone();
@@ -570,18 +570,18 @@ impl Externals for MockSubstrate {
 
                 let mut account = [0u8; 32];
 
-                assert!(account_len == 32, "seal_transfer: len = {}", account_len);
+                assert!(account_len == 32, "seal_transfer: len = {account_len}");
 
                 if let Err(e) = self.vm.memory.get_into(account_ptr, &mut account) {
-                    panic!("seal_transfer: {}", e);
+                    panic!("seal_transfer: {e}");
                 }
 
                 let mut value = [0u8; 16];
 
-                assert!(value_len == 16, "seal_transfer: len = {}", value_len);
+                assert!(value_len == 16, "seal_transfer: len = {value_len}");
 
                 if let Err(e) = self.vm.memory.get_into(value_ptr, &mut value) {
-                    panic!("seal_transfer: {}", e);
+                    panic!("seal_transfer: {e}");
                 }
 
                 let value = u128::from_le_bytes(value);
@@ -613,13 +613,13 @@ impl Externals for MockSubstrate {
                 let mut codehash = [0u8; 32];
 
                 if let Err(e) = self.vm.memory.get_into(codehash_ptr, &mut codehash) {
-                    panic!("seal_instantiate: {}", e);
+                    panic!("seal_instantiate: {e}");
                 }
 
                 let mut value = [0u8; 16];
 
                 if let Err(e) = self.vm.memory.get_into(value_ptr, &mut value) {
-                    panic!("seal_instantiate: {}", e);
+                    panic!("seal_instantiate: {e}");
                 }
 
                 let value = u128::from_le_bytes(value);
@@ -628,14 +628,14 @@ impl Externals for MockSubstrate {
                 input.resize(input_len as usize, 0u8);
 
                 if let Err(e) = self.vm.memory.get_into(input_ptr, &mut input) {
-                    panic!("seal_instantiate: {}", e);
+                    panic!("seal_instantiate: {e}");
                 }
 
                 let mut salt = Vec::new();
                 salt.resize(salt_len as usize, 0u8);
 
                 if let Err(e) = self.vm.memory.get_into(salt_ptr, &mut salt) {
-                    panic!("seal_instantiate: {}", e);
+                    panic!("seal_instantiate: {e}");
                 }
 
                 println!(
@@ -671,7 +671,7 @@ impl Externals for MockSubstrate {
                 input.resize(input_len as usize, 0u8);
 
                 if let Err(e) = self.vm.memory.get_into(input_ptr, &mut input) {
-                    panic!("seal_instantiate: {}", e);
+                    panic!("seal_instantiate: {e}");
                 }
 
                 let mut vm = VirtualMachine::new(account, self.vm.account, value);
@@ -696,7 +696,7 @@ impl Externals for MockSubstrate {
                         }
                     },
                     Ok(v) => v,
-                    Err(e) => panic!("fail to invoke deploy: {}", e),
+                    Err(e) => panic!("fail to invoke deploy: {e}"),
                 };
 
                 let output = self.vm.output.clone();
@@ -720,7 +720,7 @@ impl Externals for MockSubstrate {
                     );
                 }
 
-                println!("seal_instantiate ret:{:?}", ret);
+                println!("seal_instantiate ret:{ret:?}");
 
                 Ok(ret)
             }
@@ -821,7 +821,7 @@ impl Externals for MockSubstrate {
                 let mut account = [0u8; 32];
 
                 if let Err(e) = self.vm.memory.get_into(account_ptr, &mut account) {
-                    panic!("seal_terminate: {}", e);
+                    panic!("seal_terminate: {e}");
                 }
 
                 let remaining = self.accounts[&self.vm.account].1;
@@ -849,7 +849,7 @@ impl Externals for MockSubstrate {
                     let mut vec_length = [0u8];
 
                     if let Err(e) = self.vm.memory.get_into(topic_ptr, &mut vec_length) {
-                        panic!("seal_deposit_event: topic: {}", e);
+                        panic!("seal_deposit_event: topic: {e}");
                     }
 
                     println!("topic_len: {} first byte: {}", topic_len, vec_length[0]);
@@ -861,7 +861,7 @@ impl Externals for MockSubstrate {
                 for _ in 0..topic_len / 32 {
                     let mut topic = [0u8; 32];
                     if let Err(e) = self.vm.memory.get_into(topic_ptr, &mut topic) {
-                        panic!("seal_deposit_event: topic: {}", e);
+                        panic!("seal_deposit_event: topic: {e}");
                     }
                     topics.push(topic);
                     topic_ptr += 32;
@@ -871,7 +871,7 @@ impl Externals for MockSubstrate {
                 data.resize(data_len as usize, 0);
 
                 if let Err(e) = self.vm.memory.get_into(data_ptr, &mut data) {
-                    panic!("seal_deposit_event: data: {}", e);
+                    panic!("seal_deposit_event: data: {e}");
                 }
 
                 println!(
@@ -888,7 +888,7 @@ impl Externals for MockSubstrate {
 
                 Ok(None)
             }
-            _ => panic!("external {} unknown", index),
+            _ => panic!("external {index} unknown"),
         }
     }
 }
@@ -922,7 +922,7 @@ impl ModuleImportResolver for MockSubstrate {
             "seal_deposit_event" => SubstrateExternal::seal_deposit_event,
             "seal_transfer" => SubstrateExternal::seal_transfer,
             _ => {
-                panic!("{} not implemented", field_name);
+                panic!("{field_name} not implemented");
             }
         };
 
@@ -965,10 +965,10 @@ impl MockSubstrate {
                         panic!("did not go as planned");
                     }
                 }
-                _ => panic!("fail to invoke deploy: {}", trap),
+                _ => panic!("fail to invoke deploy: {trap}"),
             },
             Ok(v) => v,
-            Err(e) => panic!("fail to invoke deploy: {}", e),
+            Err(e) => panic!("fail to invoke deploy: {e}"),
         }
     }
 
@@ -984,10 +984,10 @@ impl MockSubstrate {
                         panic!("did not go as planned");
                     }
                 }
-                _ => panic!("fail to invoke call: {}", trap),
+                _ => panic!("fail to invoke call: {trap}"),
             },
             Ok(v) => v,
-            Err(e) => panic!("fail to invoke call: {}", e),
+            Err(e) => panic!("fail to invoke call: {e}"),
         }
     }
 
@@ -1045,10 +1045,7 @@ impl MockSubstrate {
         let ret = self.invoke_deploy(module);
 
         if let Some(RuntimeValue::I32(ret)) = ret {
-            println!(
-                "function_expected_return: got {} expected {}",
-                ret, expected_ret
-            );
+            println!("function_expected_return: got {ret} expected {expected_ret}");
 
             if expected_ret != ret {
                 panic!("non one return")
@@ -1078,7 +1075,7 @@ impl MockSubstrate {
         println!("input:{}", hex::encode(&self.vm.input));
 
         if let Some(RuntimeValue::I32(ret)) = self.invoke_call(module) {
-            assert!(ret == 0, "non zero return: {}", ret);
+            assert!(ret == 0, "non zero return: {ret}");
         }
     }
 
@@ -1104,13 +1101,13 @@ impl MockSubstrate {
         match module.invoke_export("call", &[], self) {
             Err(wasmi::Error::Trap(trap)) => match trap.kind() {
                 TrapKind::Unreachable => (),
-                _ => panic!("trap: {:?}", trap),
+                _ => panic!("trap: {trap:?}"),
             },
             Err(err) => {
-                panic!("unexpected error: {:?}", err);
+                panic!("unexpected error: {err:?}");
             }
             Ok(v) => {
-                panic!("unexpected return value: {:?}", v);
+                panic!("unexpected return value: {v:?}");
             }
         }
     }
@@ -1135,13 +1132,13 @@ impl MockSubstrate {
         match module.invoke_export("call", &[], self) {
             Err(wasmi::Error::Trap(trap)) => match trap.kind() {
                 TrapKind::Unreachable => (),
-                _ => panic!("trap: {:?}", trap),
+                _ => panic!("trap: {trap:?}"),
             },
             Err(err) => {
-                panic!("unexpected error: {:?}", err);
+                panic!("unexpected error: {err:?}");
             }
             Ok(v) => {
-                panic!("unexpected return value: {:?}", v);
+                panic!("unexpected return value: {v:?}");
             }
         }
     }
@@ -1160,7 +1157,7 @@ impl MockSubstrate {
 
     pub fn heap_verify(&self) {
         let memsize = self.vm.memory.current_size().0 * 0x10000;
-        println!("memory size:{}", memsize);
+        println!("memory size:{memsize}");
         let mut buf = Vec::new();
         buf.resize(memsize, 0);
 
@@ -1173,10 +1170,7 @@ impl MockSubstrate {
             let length: u32 = self.vm.memory.get_value(current_elem + 8).unwrap();
             let allocated: u32 = self.vm.memory.get_value(current_elem + 12).unwrap();
 
-            println!(
-                "next:{:08x} prev:{:08x} length:{} allocated:{}",
-                next, prev, length, allocated
-            );
+            println!("next:{next:08x} prev:{prev:08x} length:{length} allocated:{allocated}");
 
             let mut buf = vec![0u8; length as usize];
 
@@ -1200,14 +1194,14 @@ impl MockSubstrate {
                             break;
                         }
                         let b = buf[offset + i];
-                        write!(hex, " {:02x}", b).unwrap();
+                        write!(hex, " {b:02x}").unwrap();
                         if b.is_ascii() && !b.is_ascii_control() {
                             write!(chars, "  {}", b as char).unwrap();
                         } else {
                             chars.push_str("   ");
                         }
                     }
-                    println!("{}\n{}", hex, chars);
+                    println!("{hex}\n{chars}");
                 }
             }
 

+ 8 - 8
tests/substrate_tests/expressions.rs

@@ -954,7 +954,7 @@ fn test_power_overflow_boundaries() {
                 return a ** b;
             }
         }"#
-        .replace("intN", &format!("int{}", width));
+        .replace("intN", &format!("int{width}"));
 
         let mut contract = build_solidity_with_options(&src, true, false);
 
@@ -1036,7 +1036,7 @@ fn multiply() {
         let (a, a_data) = rand();
         let (b, b_data) = rand();
 
-        println!("in: a:{:?} b:{:?}", a_data, b_data);
+        println!("in: a:{a_data:?} b:{b_data:?}");
 
         runtime.function(
             "multiply",
@@ -1047,7 +1047,7 @@ fn multiply() {
 
         let res = BigInt::from_bytes_le(Sign::Plus, &runtime.vm.output);
 
-        println!("{} = {} * {}", res, a, b);
+        println!("{res} = {a} * {b}");
 
         // the result is truncated to $size bytes. We do this here by converting to Vec<u8> and truncating
         // it. A truncating bigint multiply would be nicer.
@@ -1069,7 +1069,7 @@ fn test_mul_within_range_signed() {
                 return a * b;
             }
         }"#
-        .replace("intN", &format!("int{}", width));
+        .replace("intN", &format!("int{width}"));
 
         let width_rounded = (width / 8_usize).next_power_of_two();
 
@@ -1114,7 +1114,7 @@ fn test_mul_within_range() {
                 return a * b;
             }
         }"#
-        .replace("intN", &format!("int{}", width));
+        .replace("intN", &format!("int{width}"));
 
         let width_rounded = (width as usize / 8).next_power_of_two();
         let mut runtime = build_solidity(&src);
@@ -1155,7 +1155,7 @@ fn test_overflow_boundaries() {
                 return a * b;
             }
         }"#
-        .replace("intN", &format!("int{}", width));
+        .replace("intN", &format!("int{width}"));
         let mut contract = build_solidity_with_options(&src, true, false);
 
         // The range of values that can be held in signed N bits is [-2^(N-1), 2^(N-1)-1]. We generate these boundaries:
@@ -1286,7 +1286,7 @@ fn test_overflow_detect_signed() {
                 return a * b;
             }
         }"#
-        .replace("intN", &format!("int{}", width));
+        .replace("intN", &format!("int{width}"));
         let mut contract = build_solidity_with_options(&src, true, false);
 
         // The range of values that can be held in signed N bits is [-2^(N-1), 2^(N-1)-1] .Generate a value that will overflow this range:
@@ -1348,7 +1348,7 @@ fn test_overflow_detect_unsigned() {
                 return a * b;
             }
         }"#
-        .replace("intN", &format!("int{}", width));
+        .replace("intN", &format!("int{width}"));
         let mut contract = build_solidity_with_options(&src, true, false);
 
         // The range of values that can be held in signed N bits is [-2^(N-1), 2^(N-1)-1].

+ 1 - 1
tests/substrate_tests/strings.rs

@@ -282,7 +282,7 @@ fn string_abi_decode() {
 
     assert_eq!(
         runtime.vm.output,
-        Val(format!(" {} ", moby_dick_first_para)).encode()
+        Val(format!(" {moby_dick_first_para} ")).encode()
     );
 
     let mut rng = rand::thread_rng();