clippy: expect large variants and other small fixes (#19222)

# Objective

- Fix CI

## Solution

- Expect new lint
- See #19220

## Testing

- cargo clippy
This commit is contained in:
atlv 2025-05-15 18:29:59 -04:00 committed by GitHub
parent 01d2b8571c
commit 415ffa5028
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 35 additions and 5 deletions

View File

@ -1847,8 +1847,7 @@ mod tests {
let mut new = value.map_unchanged(|ptr| {
// SAFETY: The underlying type of `ptr` matches `reflect_from_ptr`.
let value = unsafe { reflect_from_ptr.as_reflect_mut(ptr) };
value
unsafe { reflect_from_ptr.as_reflect_mut(ptr) }
});
assert!(!new.is_changed());

View File

@ -392,6 +392,10 @@ where
}
/// The buffer of GPU preprocessing work items for a single view.
#[expect(
clippy::large_enum_variant,
reason = "See https://github.com/bevyengine/bevy/issues/19220"
)]
pub enum PreprocessWorkItemBuffers {
/// The work items we use if we aren't using indirect drawing.
///

View File

@ -158,6 +158,10 @@ pub struct MeshBufferSlice<'a> {
pub struct SlabId(pub NonMaxU32);
/// Data for a single slab.
#[expect(
clippy::large_enum_variant,
reason = "See https://github.com/bevyengine/bevy/issues/19220"
)]
enum Slab {
/// A slab that can contain multiple objects.
General(GeneralSlab),

View File

@ -80,6 +80,10 @@ pub struct CachedPipeline {
}
/// State of a cached pipeline inserted into a [`PipelineCache`].
#[expect(
clippy::large_enum_variant,
reason = "See https://github.com/bevyengine/bevy/issues/19220"
)]
#[derive(Debug)]
pub enum CachedPipelineState {
/// The pipeline GPU object is queued for creation.
@ -189,6 +193,10 @@ impl ShaderCache {
}
}
#[expect(
clippy::result_large_err,
reason = "See https://github.com/bevyengine/bevy/issues/19220"
)]
fn add_import_to_composer(
composer: &mut naga_oil::compose::Composer,
import_path_shaders: &HashMap<ShaderImport, AssetId<Shader>>,
@ -216,6 +224,10 @@ impl ShaderCache {
Ok(())
}
#[expect(
clippy::result_large_err,
reason = "See https://github.com/bevyengine/bevy/issues/19220"
)]
fn get(
&mut self,
render_device: &RenderDevice,
@ -1090,6 +1102,10 @@ fn create_pipeline_task(
target_os = "macos",
not(feature = "multi_threaded")
))]
#[expect(
clippy::large_enum_variant,
reason = "See https://github.com/bevyengine/bevy/issues/19220"
)]
fn create_pipeline_task(
task: impl Future<Output = Result<Pipeline, PipelineCacheError>> + Send + 'static,
_sync: bool,
@ -1101,6 +1117,10 @@ fn create_pipeline_task(
}
/// Type of error returned by a [`PipelineCache`] when the creation of a GPU pipeline object failed.
#[expect(
clippy::large_enum_variant,
reason = "See https://github.com/bevyengine/bevy/issues/19220"
)]
#[derive(Error, Debug)]
pub enum PipelineCacheError {
#[error(

View File

@ -152,6 +152,10 @@ pub struct RenderResources(
);
/// An enum describing how the renderer will initialize resources. This is used when creating the [`RenderPlugin`](crate::RenderPlugin).
#[expect(
clippy::large_enum_variant,
reason = "See https://github.com/bevyengine/bevy/issues/19220"
)]
pub enum RenderCreation {
/// Allows renderer resource initialization to happen outside of the rendering plugin.
Manual(RenderResources),

View File

@ -532,7 +532,7 @@ fn get_attrs<'a>(
face_info: &'a FontFaceInfo,
scale_factor: f64,
) -> Attrs<'a> {
let attrs = Attrs::new()
Attrs::new()
.metadata(span_index)
.family(Family::Name(&face_info.family_name))
.stretch(face_info.stretch)
@ -545,8 +545,7 @@ fn get_attrs<'a>(
}
.scale(scale_factor as f32),
)
.color(cosmic_text::Color(color.to_linear().as_u32()));
attrs
.color(cosmic_text::Color(color.to_linear().as_u32()))
}
/// Calculate the size of the text area for the given buffer.