Fix formatting.

This commit is contained in:
Stephen Chung 2021-10-23 12:28:42 +08:00
parent 07181feacf
commit a51482e9c8

View File

@ -80,7 +80,7 @@ pub fn generate_body(
continue; continue;
} }
let fn_token_name = syn::Ident::new( let fn_token_name = syn::Ident::new(
&format!("{}_token", function.name().to_string()), &format!("{}_token", function.name()),
function.name().span(), function.name().span(),
); );
let reg_names = function.exported_names(); let reg_names = function.exported_names();
@ -262,11 +262,11 @@ pub fn check_rename_collisions(fns: &[ExportedFn]) -> Result<(), syn::Error> {
if let Some(other_span) = renames.insert(key, current_span) { if let Some(other_span) = renames.insert(key, current_span) {
let mut err = syn::Error::new( let mut err = syn::Error::new(
current_span, current_span,
format!("duplicate Rhai signature for '{}'", &fn_name), format!("duplicate Rhai signature for '{}'", fn_name),
); );
err.combine(syn::Error::new( err.combine(syn::Error::new(
other_span, other_span,
format!("duplicated function renamed '{}'", &fn_name), format!("duplicated function renamed '{}'", fn_name),
)); ));
return Err(err); return Err(err);
} }
@ -274,13 +274,11 @@ pub fn check_rename_collisions(fns: &[ExportedFn]) -> Result<(), syn::Error> {
} else { } else {
let ident = item_fn.name(); let ident = item_fn.name();
if let Some(other_span) = fn_defs.insert(ident.to_string(), ident.span()) { if let Some(other_span) = fn_defs.insert(ident.to_string(), ident.span()) {
let mut err = syn::Error::new( let mut err =
ident.span(), syn::Error::new(ident.span(), format!("duplicate function '{}'", ident));
format!("duplicate function '{}'", ident.to_string()),
);
err.combine(syn::Error::new( err.combine(syn::Error::new(
other_span, other_span,
format!("duplicated function '{}'", ident.to_string()), format!("duplicated function '{}'", ident),
)); ));
return Err(err); return Err(err);
} }
@ -288,11 +286,11 @@ pub fn check_rename_collisions(fns: &[ExportedFn]) -> Result<(), syn::Error> {
if let Some(fn_span) = renames.get(&key) { if let Some(fn_span) = renames.get(&key) {
let mut err = syn::Error::new( let mut err = syn::Error::new(
ident.span(), ident.span(),
format!("duplicate Rhai signature for '{}'", &ident), format!("duplicate Rhai signature for '{}'", ident),
); );
err.combine(syn::Error::new( err.combine(syn::Error::new(
*fn_span, *fn_span,
format!("duplicated function '{}'", &ident), format!("duplicated function '{}'", ident),
)); ));
return Err(err); return Err(err);
} }