auto clippy fixes

This commit is contained in:
Folkert 2023-06-26 20:42:50 +02:00
parent 72c85efc83
commit ef39bad7c6
No known key found for this signature in database
GPG key ID: 1F17F6FFD112B97C
146 changed files with 750 additions and 1005 deletions

View file

@ -313,7 +313,7 @@ impl<'a, 'r> WasmBackend<'a, 'r> {
if let Ok(sym_index) = self.module.linking.find_internal_symbol(START) {
let fn_index = match self.module.linking.symbol_table[sym_index] {
SymInfo::Function(WasmObjectSymbol::ExplicitlyNamed { index, .. }) => index,
_ => panic!("linker symbol `{}` is not a function", START),
_ => panic!("linker symbol `{START}` is not a function"),
};
self.module.export.append(Export {
name: START,
@ -463,7 +463,7 @@ impl<'a, 'r> WasmBackend<'a, 'r> {
if DEBUG_SETTINGS.storage_map {
println!("\nStorage:");
for (sym, storage) in self.storage.symbol_storage_map.iter() {
println!("{:?} => {:?}", sym, storage);
println!("{sym:?} => {storage:?}");
}
}
}
@ -1424,7 +1424,7 @@ impl<'a, 'r> WasmBackend<'a, 'r> {
.host_lookup
.iter()
.find(|(fn_name, _)| *fn_name == name)
.unwrap_or_else(|| panic!("The Roc app tries to call `{}` but I can't find it!", name));
.unwrap_or_else(|| panic!("The Roc app tries to call `{name}` but I can't find it!"));
self.called_fns.set(*fn_index as usize, true);
@ -1614,7 +1614,7 @@ impl<'a, 'r> WasmBackend<'a, 'r> {
ListLiteralElement::Literal(lit) => {
// This has no Symbol but our storage methods expect one.
// Let's just pretend it was defined in a `Let`.
let debug_name = format!("{:?}_{}", sym, i);
let debug_name = format!("{sym:?}_{i}");
let elem_sym = self.create_symbol(&debug_name);
let expr = Expr::Literal(*lit);

View file

@ -322,10 +322,7 @@ impl<'a> CodeBuilder<'a> {
self.add_insertion(pushed_at, SETLOCAL, local_id.0);
} else {
if DEBUG_SETTINGS.instructions {
println!(
"{:?} has been popped implicitly. Leaving it on the stack.",
symbol
);
println!("{symbol:?} has been popped implicitly. Leaving it on the stack.");
}
self.add_insertion(pushed_at, TEELOCAL, local_id.0);
}
@ -501,9 +498,7 @@ impl<'a> CodeBuilder<'a> {
debug_assert!(
stack_size >= pops,
"Wasm value stack underflow. Tried to pop {} but only {} available",
pops,
stack_size
"Wasm value stack underflow. Tried to pop {pops} but only {stack_size} available"
);
let new_len = stack_size - pops;
@ -517,11 +512,7 @@ impl<'a> CodeBuilder<'a> {
/// Plain instruction without any immediates
fn inst(&mut self, opcode: OpCode, pops: usize, push: bool) {
self.inst_base(opcode, pops, push);
log_instruction!(
"{:10}\t\t{:?}",
format!("{:?}", opcode),
self.vm_block_stack
);
log_instruction!("{:10}\t\t{:?}", format!("{opcode:?}"), self.vm_block_stack);
}
/// Block instruction
@ -538,7 +529,7 @@ impl<'a> CodeBuilder<'a> {
value_stack: Vec::with_capacity_in(8, self.arena),
});
log_instruction!("{:10}\t{:?}", format!("{:?}", opcode), &self.vm_block_stack);
log_instruction!("{:10}\t{:?}", format!("{opcode:?}"), &self.vm_block_stack);
}
fn inst_imm32(&mut self, opcode: OpCode, pops: usize, push: bool, immediate: u32) {
@ -546,7 +537,7 @@ impl<'a> CodeBuilder<'a> {
self.code.encode_u32(immediate);
log_instruction!(
"{:10}\t{}\t{:?}",
format!("{:?}", opcode),
format!("{opcode:?}"),
immediate,
self.vm_block_stack
);
@ -558,7 +549,7 @@ impl<'a> CodeBuilder<'a> {
self.code.encode_u32(offset);
log_instruction!(
"{:10} {:?} {}\t{:?}",
format!("{:?}", opcode),
format!("{opcode:?}"),
align,
offset,
self.vm_block_stack
@ -654,7 +645,7 @@ impl<'a> CodeBuilder<'a> {
log_instruction!(
"{:10}\t{}\t{:?}",
format!("{:?}", CALL),
format!("{CALL:?}"),
function_index,
self.vm_block_stack
);
@ -725,7 +716,7 @@ impl<'a> CodeBuilder<'a> {
{
log_instruction!(
"{:10}\t{}\t{:?}",
format!("{:?}", opcode),
format!("{opcode:?}"),
x,
self.vm_block_stack
);

View file

@ -2063,8 +2063,7 @@ impl<'a> LowLevelCall<'a> {
.runtime_representation(backend.storage.symbol_layouts[&self.arguments[1]]);
debug_assert_eq!(
arg_layout_raw, other_arg_layout,
"Cannot do `==` comparison on different types: {:?} vs {:?}",
arg_layout, other_arg_layout
"Cannot do `==` comparison on different types: {arg_layout:?} vs {other_arg_layout:?}"
);
let invert_result = matches!(self.lowlevel, LowLevel::NotEq);
@ -2502,7 +2501,7 @@ pub fn call_higher_order_lowlevel<'a>(
}
}
};
let wrapper_sym = backend.create_symbol(&format!("#wrap#{:?}", fn_name));
let wrapper_sym = backend.create_symbol(&format!("#wrap#{fn_name:?}"));
let wrapper_layout = {
let mut wrapper_arg_layouts: Vec<InLayout<'a>> =
Vec::with_capacity_in(argument_layouts.len() + 1, backend.env.arena);