diff --git a/cranelift/codegen/meta/src/cdsl/ast.rs b/cranelift/codegen/meta/src/cdsl/ast.rs index 82cdbad762..6bfd1721ae 100644 --- a/cranelift/codegen/meta/src/cdsl/ast.rs +++ b/cranelift/codegen/meta/src/cdsl/ast.rs @@ -296,7 +296,8 @@ impl Var { pub fn set_def(&mut self, position: PatternPosition, def: DefIndex) { assert!( self.get_def(position).is_none(), - format!("redefinition of variable {}", self.name) + "redefinition of variable {}", + self.name ); match position { PatternPosition::Source => { @@ -461,7 +462,8 @@ impl Apply { // Basic check on number of arguments. assert!( inst.operands_in.len() == args.len(), - format!("incorrect number of arguments in instruction {}", inst.name) + "incorrect number of arguments in instruction {}", + inst.name ); // Check that the kinds of Literals arguments match the expected operand. diff --git a/cranelift/codegen/meta/src/cdsl/encodings.rs b/cranelift/codegen/meta/src/cdsl/encodings.rs index f66746f92f..4d11beb206 100644 --- a/cranelift/codegen/meta/src/cdsl/encodings.rs +++ b/cranelift/codegen/meta/src/cdsl/encodings.rs @@ -153,10 +153,9 @@ impl EncodingBuilder { let inst = self.inst.inst(); assert!( Rc::ptr_eq(&inst.format, &recipes[self.recipe].format), - format!( - "Inst {} and recipe {} must have the same format!", - inst.name, recipes[self.recipe].name - ) + "Inst {} and recipe {} must have the same format!", + inst.name, + recipes[self.recipe].name ); assert_eq!( diff --git a/cranelift/codegen/meta/src/cdsl/instructions.rs b/cranelift/codegen/meta/src/cdsl/instructions.rs index 88a15c6038..489217033a 100644 --- a/cranelift/codegen/meta/src/cdsl/instructions.rs +++ b/cranelift/codegen/meta/src/cdsl/instructions.rs @@ -394,7 +394,7 @@ impl ValueTypeOrAny { pub fn expect(self, msg: &str) -> ValueType { match self { ValueTypeOrAny::ValueType(vt) => vt, - ValueTypeOrAny::Any => panic!(format!("Unexpected Any: {}", msg)), + ValueTypeOrAny::Any => panic!("Unexpected Any: {}", msg), } } } @@ -665,7 +665,7 @@ fn verify_polymorphic( if operands_out.is_empty() { // No result means no other possible type variable, so it's a type inference failure. match maybe_error_message { - Some(msg) => panic!(msg), + Some(msg) => panic!("{}", msg), None => panic!("typevar_operand must be a free type variable"), } } diff --git a/cranelift/codegen/meta/src/cdsl/recipes.rs b/cranelift/codegen/meta/src/cdsl/recipes.rs index dfe4cd67a5..e03b951f4d 100644 --- a/cranelift/codegen/meta/src/cdsl/recipes.rs +++ b/cranelift/codegen/meta/src/cdsl/recipes.rs @@ -260,10 +260,9 @@ impl EncodingRecipeBuilder { if !self.format.has_value_list { assert!( operands_in.len() == self.format.num_value_operands, - format!( - "missing operand constraints for recipe {} (format {})", - self.name, self.format.name - ) + "missing operand constraints for recipe {} (format {})", + self.name, + self.format.name ); } diff --git a/cranelift/codegen/meta/src/cdsl/type_inference.rs b/cranelift/codegen/meta/src/cdsl/type_inference.rs index 25a07a9b84..e17c305f9c 100644 --- a/cranelift/codegen/meta/src/cdsl/type_inference.rs +++ b/cranelift/codegen/meta/src/cdsl/type_inference.rs @@ -210,7 +210,8 @@ impl TypeEnvironment { None => { assert!( !actual_tv.name.starts_with("typeof_"), - format!("variable {} should be explicitly ranked", actual_tv.name) + "variable {} should be explicitly ranked", + actual_tv.name ); None } diff --git a/cranelift/codegen/meta/src/cdsl/xform.rs b/cranelift/codegen/meta/src/cdsl/xform.rs index d21e93128d..95b7af867c 100644 --- a/cranelift/codegen/meta/src/cdsl/xform.rs +++ b/cranelift/codegen/meta/src/cdsl/xform.rs @@ -74,19 +74,18 @@ impl Transform { for &var_index in &input_vars { assert!( var_pool.get(var_index).is_input(), - format!("'{:?}' used as both input and def", var_pool.get(var_index)) + "'{:?}' used as both input and def", + var_pool.get(var_index) ); } assert!( input_vars.len() == num_src_inputs, - format!( - "extra input vars in dst pattern: {:?}", - input_vars - .iter() - .map(|&i| var_pool.get(i)) - .skip(num_src_inputs) - .collect::>() - ) + "extra input vars in dst pattern: {:?}", + input_vars + .iter() + .map(|&i| var_pool.get(i)) + .skip(num_src_inputs) + .collect::>() ); // Perform type inference and cleanup. @@ -143,7 +142,8 @@ impl Transform { let defined_var = self.var_pool.get(var_index); assert!( defined_var.is_output(), - format!("{:?} not defined in the destination pattern", defined_var) + "{:?} not defined in the destination pattern", + defined_var ); } } @@ -226,7 +226,8 @@ fn rewrite_expr( let var = var_pool.get(own_var); assert!( var.is_input() || var.get_def(position).is_some(), - format!("{:?} used as both input and def", var) + "{:?} used as both input and def", + var ); args.push(Expr::Var(own_var)); } @@ -400,10 +401,8 @@ impl TransformGroupBuilder { self.custom_legalizes .insert(inst.camel_name.clone(), func_name) .is_none(), - format!( - "custom legalization action for {} inserted twice", - inst.name - ) + "custom legalization action for {} inserted twice", + inst.name ); } @@ -442,7 +441,8 @@ impl TransformGroups { for group in self.groups.values() { assert!( group.name != new_group.name, - format!("trying to insert {} for the second time", new_group.name) + "trying to insert {} for the second time", + new_group.name ); } self.groups.push(new_group) @@ -459,7 +459,7 @@ impl TransformGroups { return group; } } - panic!(format!("transform group with name {} not found", name)); + panic!("transform group with name {} not found", name); } } diff --git a/cranelift/codegen/meta/src/gen_encodings.rs b/cranelift/codegen/meta/src/gen_encodings.rs index d79dc66340..d7bb289bd2 100644 --- a/cranelift/codegen/meta/src/gen_encodings.rs +++ b/cranelift/codegen/meta/src/gen_encodings.rs @@ -99,8 +99,8 @@ fn emit_instp(instp: &InstructionPredicate, has_func: bool, fmt: &mut Formatter) Some(previous_format_name) => { assert!( previous_format_name == leaf_format_name, - format!("Format predicate can only operate on a single InstructionFormat; trying to use both {} and {}", previous_format_name, leaf_format_name - )); + "Format predicate can only operate on a single InstructionFormat; trying to use both {} and {}", previous_format_name, leaf_format_name + ); } } } diff --git a/cranelift/codegen/meta/src/isa/riscv/recipes.rs b/cranelift/codegen/meta/src/isa/riscv/recipes.rs index 47acdbb042..dc879dcecb 100644 --- a/cranelift/codegen/meta/src/isa/riscv/recipes.rs +++ b/cranelift/codegen/meta/src/isa/riscv/recipes.rs @@ -25,7 +25,8 @@ impl RecipeGroup { fn push(&mut self, builder: EncodingRecipeBuilder) { assert!( self.name_to_recipe.get(&builder.name).is_none(), - format!("riscv recipe '{}' created twice", builder.name) + "riscv recipe '{}' created twice", + builder.name ); let name = builder.name.clone(); let number = self.recipes.push(builder.build()); diff --git a/cranelift/codegen/meta/src/isa/x86/encodings.rs b/cranelift/codegen/meta/src/isa/x86/encodings.rs index bdfcef9c6f..2f222defb5 100644 --- a/cranelift/codegen/meta/src/isa/x86/encodings.rs +++ b/cranelift/codegen/meta/src/isa/x86/encodings.rs @@ -45,10 +45,8 @@ impl PerCpuModeEncodings { if let Some(found_index) = self.recipes_by_name.get(&recipe.name) { assert!( self.recipes[*found_index] == recipe, - format!( - "trying to insert different recipes with a same name ({})", - recipe.name - ) + "trying to insert different recipes with a same name ({})", + recipe.name ); *found_index } else {