From 56b7a23f180d85b953be957e3fa125f7d35a27ea Mon Sep 17 00:00:00 2001 From: Lukas Wirth Date: Fri, 25 Oct 2024 12:58:45 +0200 Subject: [PATCH] Improve the span used for salsa struct constructors --- components/salsa-macro-rules/src/setup_tracked_fn.rs | 2 +- components/salsa-macros/src/salsa_struct.rs | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/components/salsa-macro-rules/src/setup_tracked_fn.rs b/components/salsa-macro-rules/src/setup_tracked_fn.rs index 3d5862d4..3c85af79 100644 --- a/components/salsa-macro-rules/src/setup_tracked_fn.rs +++ b/components/salsa-macro-rules/src/setup_tracked_fn.rs @@ -204,7 +204,7 @@ macro_rules! setup_tracked_fn { aux: &dyn $zalsa::JarAux, first_index: $zalsa::IngredientIndex, ) -> Vec> { - let mut fn_ingredient = <$zalsa::function::IngredientImpl<$Configuration>>::new( + let fn_ingredient = <$zalsa::function::IngredientImpl<$Configuration>>::new( first_index, aux, ); diff --git a/components/salsa-macros/src/salsa_struct.rs b/components/salsa-macros/src/salsa_struct.rs index b93470a4..1a24fdc4 100644 --- a/components/salsa-macros/src/salsa_struct.rs +++ b/components/salsa-macros/src/salsa_struct.rs @@ -30,7 +30,6 @@ use crate::{ options::{AllowedOptions, Options}, }; use proc_macro2::{Ident, Literal, Span, TokenStream}; -use syn::spanned::Spanned; pub(crate) struct SalsaStruct<'s, A: SalsaStructAllowedOptions> { struct_item: &'s syn::ItemStruct, @@ -115,7 +114,7 @@ where pub(crate) fn constructor_name(&self) -> syn::Ident { match self.args.constructor_name.clone() { Some(name) => name, - None => Ident::new("new", self.struct_item.span()), + None => Ident::new("new", self.struct_item.ident.span()), } }