fix clippy warnings

This commit is contained in:
Niko Matsakis 2024-04-02 06:29:44 -04:00
parent 3a15db7f36
commit 39321ed920
7 changed files with 8 additions and 13 deletions

View file

@ -240,7 +240,6 @@ impl<A: AllowedOptions> SalsaStruct<A> {
// `::salsa::debug::helper::SalsaDebug` will use `DebugWithDb` or fallbak to `Debug`
let fields = self
.all_fields()
.into_iter()
.map(|field| -> TokenStream {
let field_name_string = field.name().to_string();
let field_getter = field.get_name();
@ -338,7 +337,7 @@ impl SalsaField {
if BANNED_FIELD_NAMES.iter().any(|n| *n == field_name_str) {
return Err(syn::Error::new(
field_name.span(),
&format!(
format!(
"the field name `{}` is disallowed in salsa structs",
field_name_str
),

View file

@ -105,6 +105,7 @@ pub(crate) fn tracked_impl(
),
None => format!("{}", self_type_name),
};
#[allow(clippy::manual_try_fold)] // we accumulate errors
let extra_impls = item_impl
.items
.iter_mut()

View file

@ -130,6 +130,7 @@ impl TrackedStruct {
type Fields = ( #(#field_tys,)* );
type Revisions = [salsa::Revision; #arity];
#[allow(clippy::unused_unit)]
fn id_fields(fields: &Self::Fields) -> impl std::hash::Hash {
( #( &fields.#id_field_indices ),* )
}

View file

@ -221,11 +221,7 @@ pub mod helper {
use std::{fmt, marker::PhantomData};
pub trait Fallback<T: fmt::Debug, Db: ?Sized> {
fn salsa_debug<'a, 'b>(
a: &'a T,
_db: &'b Db,
_include_all_fields: bool,
) -> &'a dyn fmt::Debug {
fn salsa_debug<'a>(a: &'a T, _db: &Db, _include_all_fields: bool) -> &'a dyn fmt::Debug {
a
}
}

View file

@ -1,4 +1,4 @@
use std::hash::{BuildHasher, Hash, Hasher};
use std::hash::{BuildHasher, Hash};
pub(crate) type FxHasher = std::hash::BuildHasherDefault<rustc_hash::FxHasher>;
pub(crate) type FxIndexSet<K> = indexmap::IndexSet<K, FxHasher>;
@ -8,7 +8,5 @@ pub(crate) type FxLinkedHashSet<K> = hashlink::LinkedHashSet<K, FxHasher>;
pub(crate) type FxHashSet<K> = std::collections::HashSet<K, FxHasher>;
pub(crate) fn hash<T: Hash>(t: &T) -> u64 {
let mut hasher = FxHasher::default().build_hasher();
t.hash(&mut hasher);
hasher.finish()
FxHasher::default().hash_one(t)
}

View file

@ -4,7 +4,7 @@ use crate::storage::HasJars;
/// Initializes the `DB`'s jars in-place
///
/// # Safety:
/// # Safety
///
/// `init` must fully initialize all of jars fields
pub unsafe fn create_jars_inplace<DB: HasJars>(init: impl FnOnce(*mut DB::Jars)) -> Box<DB::Jars> {
@ -31,6 +31,7 @@ pub unsafe fn create_jars_inplace<DB: HasJars>(init: impl FnOnce(*mut DB::Jars))
//
// Safe if you know that data at `u` will remain shared
// until the reference `t` expires.
#[allow(clippy::needless_lifetimes)]
pub(crate) unsafe fn transmute_lifetime<'t, 'u, T, U>(_t: &'t T, u: &'u U) -> &'t U {
std::mem::transmute(u)
}

View file

@ -10,7 +10,6 @@ use crate::{
ingredient_list::IngredientList,
interned::{InternedId, InternedIngredient},
key::{DatabaseKeyIndex, DependencyIndex},
plumbing::transmute_lifetime,
runtime::{local_state::QueryOrigin, Runtime},
salsa_struct::SalsaStructInDb,
Database, Durability, Event, IngredientIndex, Revision,