Skip to content

Commit 415ffa5

Browse files
authored
clippy: expect large variants and other small fixes (#19222)
# Objective - Fix CI ## Solution - Expect new lint - See #19220 ## Testing - cargo clippy
1 parent 01d2b85 commit 415ffa5

File tree

6 files changed

+35
-5
lines changed

6 files changed

+35
-5
lines changed

crates/bevy_ecs/src/change_detection.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1847,8 +1847,7 @@ mod tests {
18471847

18481848
let mut new = value.map_unchanged(|ptr| {
18491849
// SAFETY: The underlying type of `ptr` matches `reflect_from_ptr`.
1850-
let value = unsafe { reflect_from_ptr.as_reflect_mut(ptr) };
1851-
value
1850+
unsafe { reflect_from_ptr.as_reflect_mut(ptr) }
18521851
});
18531852

18541853
assert!(!new.is_changed());

crates/bevy_render/src/batching/gpu_preprocessing.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,10 @@ where
392392
}
393393

394394
/// The buffer of GPU preprocessing work items for a single view.
395+
#[expect(
396+
clippy::large_enum_variant,
397+
reason = "See https://github.com/bevyengine/bevy/issues/19220"
398+
)]
395399
pub enum PreprocessWorkItemBuffers {
396400
/// The work items we use if we aren't using indirect drawing.
397401
///

crates/bevy_render/src/mesh/allocator.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,10 @@ pub struct MeshBufferSlice<'a> {
158158
pub struct SlabId(pub NonMaxU32);
159159

160160
/// Data for a single slab.
161+
#[expect(
162+
clippy::large_enum_variant,
163+
reason = "See https://github.com/bevyengine/bevy/issues/19220"
164+
)]
161165
enum Slab {
162166
/// A slab that can contain multiple objects.
163167
General(GeneralSlab),

crates/bevy_render/src/render_resource/pipeline_cache.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,10 @@ pub struct CachedPipeline {
8080
}
8181

8282
/// State of a cached pipeline inserted into a [`PipelineCache`].
83+
#[expect(
84+
clippy::large_enum_variant,
85+
reason = "See https://github.com/bevyengine/bevy/issues/19220"
86+
)]
8387
#[derive(Debug)]
8488
pub enum CachedPipelineState {
8589
/// The pipeline GPU object is queued for creation.
@@ -189,6 +193,10 @@ impl ShaderCache {
189193
}
190194
}
191195

196+
#[expect(
197+
clippy::result_large_err,
198+
reason = "See https://github.com/bevyengine/bevy/issues/19220"
199+
)]
192200
fn add_import_to_composer(
193201
composer: &mut naga_oil::compose::Composer,
194202
import_path_shaders: &HashMap<ShaderImport, AssetId<Shader>>,
@@ -216,6 +224,10 @@ impl ShaderCache {
216224
Ok(())
217225
}
218226

227+
#[expect(
228+
clippy::result_large_err,
229+
reason = "See https://github.com/bevyengine/bevy/issues/19220"
230+
)]
219231
fn get(
220232
&mut self,
221233
render_device: &RenderDevice,
@@ -1090,6 +1102,10 @@ fn create_pipeline_task(
10901102
target_os = "macos",
10911103
not(feature = "multi_threaded")
10921104
))]
1105+
#[expect(
1106+
clippy::large_enum_variant,
1107+
reason = "See https://github.com/bevyengine/bevy/issues/19220"
1108+
)]
10931109
fn create_pipeline_task(
10941110
task: impl Future<Output = Result<Pipeline, PipelineCacheError>> + Send + 'static,
10951111
_sync: bool,
@@ -1101,6 +1117,10 @@ fn create_pipeline_task(
11011117
}
11021118

11031119
/// Type of error returned by a [`PipelineCache`] when the creation of a GPU pipeline object failed.
1120+
#[expect(
1121+
clippy::large_enum_variant,
1122+
reason = "See https://github.com/bevyengine/bevy/issues/19220"
1123+
)]
11041124
#[derive(Error, Debug)]
11051125
pub enum PipelineCacheError {
11061126
#[error(

crates/bevy_render/src/settings.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,10 @@ pub struct RenderResources(
152152
);
153153

154154
/// An enum describing how the renderer will initialize resources. This is used when creating the [`RenderPlugin`](crate::RenderPlugin).
155+
#[expect(
156+
clippy::large_enum_variant,
157+
reason = "See https://github.com/bevyengine/bevy/issues/19220"
158+
)]
155159
pub enum RenderCreation {
156160
/// Allows renderer resource initialization to happen outside of the rendering plugin.
157161
Manual(RenderResources),

crates/bevy_text/src/pipeline.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,7 @@ fn get_attrs<'a>(
532532
face_info: &'a FontFaceInfo,
533533
scale_factor: f64,
534534
) -> Attrs<'a> {
535-
let attrs = Attrs::new()
535+
Attrs::new()
536536
.metadata(span_index)
537537
.family(Family::Name(&face_info.family_name))
538538
.stretch(face_info.stretch)
@@ -545,8 +545,7 @@ fn get_attrs<'a>(
545545
}
546546
.scale(scale_factor as f32),
547547
)
548-
.color(cosmic_text::Color(color.to_linear().as_u32()));
549-
attrs
548+
.color(cosmic_text::Color(color.to_linear().as_u32()))
550549
}
551550

552551
/// Calculate the size of the text area for the given buffer.

0 commit comments

Comments
 (0)