From 5ae584fab25f59520d05a18cd3d44b54c9cd98ae Mon Sep 17 00:00:00 2001 From: Stephen Chung Date: Sat, 23 Oct 2021 12:28:42 +0800 Subject: [PATCH] Fix formatting. --- codegen/src/rhai_module.rs | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/codegen/src/rhai_module.rs b/codegen/src/rhai_module.rs index f3137f78..37745945 100644 --- a/codegen/src/rhai_module.rs +++ b/codegen/src/rhai_module.rs @@ -78,7 +78,7 @@ pub fn generate_body( continue; } let fn_token_name = syn::Ident::new( - &format!("{}_token", function.name().to_string()), + &format!("{}_token", function.name()), function.name().span(), ); let reg_names = function.exported_names(); @@ -251,11 +251,11 @@ pub fn check_rename_collisions(fns: &[ExportedFn]) -> Result<(), syn::Error> { if let Some(other_span) = renames.insert(key, current_span) { let mut err = syn::Error::new( current_span, - format!("duplicate Rhai signature for '{}'", &fn_name), + format!("duplicate Rhai signature for '{}'", fn_name), ); err.combine(syn::Error::new( other_span, - format!("duplicated function renamed '{}'", &fn_name), + format!("duplicated function renamed '{}'", fn_name), )); return Err(err); } @@ -263,13 +263,11 @@ pub fn check_rename_collisions(fns: &[ExportedFn]) -> Result<(), syn::Error> { } else { let ident = item_fn.name(); if let Some(other_span) = fn_defs.insert(ident.to_string(), ident.span()) { - let mut err = syn::Error::new( - ident.span(), - format!("duplicate function '{}'", ident.to_string()), - ); + let mut err = + syn::Error::new(ident.span(), format!("duplicate function '{}'", ident)); err.combine(syn::Error::new( other_span, - format!("duplicated function '{}'", ident.to_string()), + format!("duplicated function '{}'", ident), )); return Err(err); } @@ -277,11 +275,11 @@ pub fn check_rename_collisions(fns: &[ExportedFn]) -> Result<(), syn::Error> { if let Some(fn_span) = renames.get(&key) { let mut err = syn::Error::new( ident.span(), - format!("duplicate Rhai signature for '{}'", &ident), + format!("duplicate Rhai signature for '{}'", ident), ); err.combine(syn::Error::new( *fn_span, - format!("duplicated function '{}'", &ident), + format!("duplicated function '{}'", ident), )); return Err(err); }