squelch most clippy warnings in generated code

This commit is contained in:
Niko Matsakis 2024-07-19 10:00:03 -04:00
parent 6066e0b536
commit e8b467733f
4 changed files with 6 additions and 1 deletions

View file

@ -69,6 +69,8 @@ macro_rules! setup_tracked_fn {
_priv: std::convert::Infallible,
}
// Suppress this clippy lint because we sometimes require `'db` where the ordinary Rust rules would not.
#[allow(clippy::needless_lifetimes)]
$(#[$attr])*
$vis fn $fn_name<$db_lt>(
$db: &$db_lt dyn $Db,

View file

@ -67,6 +67,8 @@ macro_rules! setup_tracked_struct {
std::marker::PhantomData < & $db_lt salsa::plumbing::tracked_struct::Value < $Struct<'static> > >
);
#[allow(clippy::all)]
#[allow(dead_code)]
const _: () = {
use salsa::plumbing as $zalsa;
use $zalsa::tracked_struct as $zalsa_struct;

View file

@ -76,6 +76,7 @@ pub(crate) fn update_derive(input: syn::DeriveInput) -> syn::Result<TokenStream>
let ident = &input.ident;
let (impl_generics, ty_generics, where_clause) = input.generics.split_for_impl();
let tokens = quote! {
#[allow(clippy::all)]
unsafe impl #impl_generics salsa::Update for #ident #ty_generics #where_clause {
unsafe fn maybe_update(#old_pointer: *mut Self, #new_value: Self) -> bool {
use ::salsa::plumbing::UpdateFallback as _;

View file

@ -17,7 +17,7 @@ struct MyTracked<'db> {
}
#[salsa::tracked]
fn tracked_fn<'db>(db: &'db dyn Db, input: MyInput) -> u32 {
fn tracked_fn(db: &dyn Db, input: MyInput) -> u32 {
db.push_log(format!("tracked_fn({input:?})"));
let t = MyTracked::new(db, input.field(db) * 2);
tracked_fn_extra::specify(db, t, 2222);