bevy_asset: Apply #![deny(clippy::allow_attributes, clippy::allow_attributes_without_reason)]
(#17113)
# Objective - https://github.com/bevyengine/bevy/issues/17111 ## Solution Set the `clippy::allow_attributes` and `clippy::allow_attributes_without_reason` lints to `deny`, and bring `bevy_asset` in line with the new restrictions. No code changes have been made - except if a lint that was previously `allow(...)`'d could be removed via small code changes. For example, `unused_variables` can be handled by adding a `_` to the beginning of a field's name. ## Testing `cargo clippy` and `cargo test --package bevy_asset --features multi_threaded` were run, and no errors were encountered.
This commit is contained in:
parent
f64f3ac997
commit
b386d08d0f
@ -148,7 +148,7 @@ pub struct AssetChangedState<A: AsAssetId> {
|
||||
_asset: PhantomData<fn(A)>,
|
||||
}
|
||||
|
||||
#[allow(unsafe_code)]
|
||||
#[expect(unsafe_code, reason = "WorldQuery is an unsafe trait.")]
|
||||
/// SAFETY: `ROQueryFetch<Self>` is the same as `QueryFetch<Self>`
|
||||
unsafe impl<A: AsAssetId> WorldQuery for AssetChanged<A> {
|
||||
type Item<'w> = ();
|
||||
@ -264,7 +264,7 @@ unsafe impl<A: AsAssetId> WorldQuery for AssetChanged<A> {
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(unsafe_code)]
|
||||
#[expect(unsafe_code, reason = "QueryFilter is an unsafe trait.")]
|
||||
/// SAFETY: read-only access
|
||||
unsafe impl<A: AsAssetId> QueryFilter for AssetChanged<A> {
|
||||
const IS_ARCHETYPAL: bool = false;
|
||||
|
@ -551,8 +551,11 @@ mod tests {
|
||||
}
|
||||
|
||||
/// Typed and Untyped `Handles` should be orderable amongst each other and themselves
|
||||
#[allow(clippy::cmp_owned)]
|
||||
#[test]
|
||||
#[expect(
|
||||
clippy::cmp_owned,
|
||||
reason = "This lints on the assertion that a typed handle converted to an untyped handle maintains its ordering compared to an untyped handle. While the conversion would normally be useless, we need to ensure that converted handles maintain their ordering, making the conversion necessary here."
|
||||
)]
|
||||
fn ordering() {
|
||||
assert!(UUID_1 < UUID_2);
|
||||
|
||||
|
@ -139,6 +139,11 @@
|
||||
//! This trait mirrors [`AssetLoader`] in structure, and works in tandem with [`AssetWriter`](io::AssetWriter), which mirrors [`AssetReader`](io::AssetReader).
|
||||
|
||||
#![expect(missing_docs, reason = "Not all docs are written yet, see #3492.")]
|
||||
#![deny(
|
||||
clippy::allow_attributes,
|
||||
clippy::allow_attributes_without_reason,
|
||||
reason = "See #17111; To be removed once all crates are in-line with these attributes"
|
||||
)]
|
||||
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
|
||||
#![doc(
|
||||
html_logo_url = "https://bevyengine.org/assets/icon.png",
|
||||
@ -1767,8 +1772,11 @@ mod tests {
|
||||
#[derive(Asset, TypePath)]
|
||||
pub struct TestAsset;
|
||||
|
||||
#[allow(dead_code)]
|
||||
#[derive(Asset, TypePath)]
|
||||
#[expect(
|
||||
dead_code,
|
||||
reason = "This exists to ensure that `#[derive(Asset)]` works on enums. The inner variants are known not to be used."
|
||||
)]
|
||||
pub enum EnumTestAsset {
|
||||
Unnamed(#[dependency] Handle<TestAsset>),
|
||||
Named {
|
||||
@ -1783,7 +1791,6 @@ mod tests {
|
||||
Empty,
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
#[derive(Asset, TypePath)]
|
||||
pub struct StructTestAsset {
|
||||
#[dependency]
|
||||
@ -1792,7 +1799,6 @@ mod tests {
|
||||
embedded: TestAsset,
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
#[derive(Asset, TypePath)]
|
||||
pub struct TupleTestAsset(#[dependency] Handle<TestAsset>);
|
||||
}
|
||||
|
@ -478,7 +478,6 @@ impl AssetProcessor {
|
||||
self.set_state(ProcessorState::Finished).await;
|
||||
}
|
||||
|
||||
#[allow(unused)]
|
||||
#[cfg(all(not(target_arch = "wasm32"), feature = "multi_threaded"))]
|
||||
async fn process_assets_internal<'scope>(
|
||||
&'scope self,
|
||||
|
@ -351,18 +351,14 @@ mod tests {
|
||||
|
||||
use super::*;
|
||||
|
||||
// The compiler notices these fields are never read and raises a dead_code lint which kill CI.
|
||||
#[allow(dead_code)]
|
||||
#[derive(Asset, TypePath, Debug)]
|
||||
struct A(usize);
|
||||
struct A;
|
||||
|
||||
#[allow(dead_code)]
|
||||
#[derive(Asset, TypePath, Debug)]
|
||||
struct B(usize);
|
||||
struct B;
|
||||
|
||||
#[allow(dead_code)]
|
||||
#[derive(Asset, TypePath, Debug)]
|
||||
struct C(usize);
|
||||
struct C;
|
||||
|
||||
struct Loader<A: Asset, const N: usize, const E: usize> {
|
||||
sender: Sender<()>,
|
||||
|
Loading…
Reference in New Issue
Block a user