From c3a1ea5d140bfd36a9dcec0ba58a8c8f18ba5b94 Mon Sep 17 00:00:00 2001 From: Erich Gubler Date: Thu, 30 Jan 2025 23:50:57 -0500 Subject: [PATCH] FIXUP: ugh yet more lint expectations --- naga/src/arena/handlevec.rs | 1 - naga/src/arena/mod.rs | 1 - naga/src/back/glsl/mod.rs | 2 +- naga/src/back/hlsl/mod.rs | 1 - naga/src/back/msl/sampler.rs | 2 -- naga/src/back/msl/writer.rs | 4 +--- naga/src/back/spv/block.rs | 2 +- naga/src/back/spv/helpers.rs | 2 +- naga/src/back/spv/image.rs | 4 ++-- naga/src/back/spv/instructions.rs | 3 +-- naga/src/back/spv/layout.rs | 2 -- naga/src/back/wgsl/writer.rs | 1 - naga/src/block.rs | 1 - naga/src/front/glsl/context.rs | 2 +- naga/src/front/glsl/functions.rs | 6 ++---- naga/src/front/spv/image.rs | 2 +- naga/src/front/spv/mod.rs | 13 +++++-------- naga/src/front/wgsl/error.rs | 2 +- naga/src/front/wgsl/lower/mod.rs | 2 +- .../wgsl/parse/directive/enable_extension.rs | 6 +++--- .../parse/directive/language_extension.rs | 1 - naga/src/front/wgsl/parse/lexer.rs | 1 - naga/src/lib.rs | 4 ++-- naga/src/proc/constant_evaluator.rs | 8 ++++---- naga/src/proc/emitter.rs | 3 --- naga/src/proc/layouter.rs | 2 +- naga/src/proc/mod.rs | 3 --- naga/src/span.rs | 1 - naga/src/valid/analyzer.rs | 5 ++--- naga/src/valid/expression.rs | 4 ++-- naga/src/valid/handles.rs | 2 +- naga/src/valid/mod.rs | 1 - wgpu-core/src/binding_model.rs | 1 - wgpu-core/src/command/bind.rs | 2 +- wgpu-core/src/conv.rs | 2 +- wgpu-core/src/device/global.rs | 4 +--- wgpu-core/src/device/mod.rs | 2 +- wgpu-core/src/device/queue.rs | 1 - wgpu-core/src/device/resource.rs | 1 - wgpu-core/src/device/trace.rs | 2 +- wgpu-core/src/hub.rs | 2 +- wgpu-core/src/id.rs | 2 +- wgpu-core/src/init_tracker/mod.rs | 1 - wgpu-core/src/instance.rs | 2 -- wgpu-core/src/lock/mod.rs | 4 ++-- wgpu-core/src/lock/observing.rs | 2 +- wgpu-core/src/lock/rank.rs | 5 ++--- wgpu-core/src/pipeline.rs | 2 +- wgpu-core/src/resource.rs | 3 +-- wgpu-core/src/validation.rs | 6 +++--- wgpu-hal/src/gles/command.rs | 9 ++++----- wgpu-hal/src/gles/device.rs | 2 +- wgpu-hal/src/gles/egl.rs | 10 ++++------ wgpu-hal/src/gles/mod.rs | 5 ++--- wgpu-hal/src/lib.rs | 19 +++++++++---------- wgpu-hal/src/metal/adapter.rs | 1 - wgpu-hal/src/metal/mod.rs | 11 +++++------ wgpu-hal/src/metal/surface.rs | 2 -- wgpu-hal/src/vulkan/adapter.rs | 2 +- wgpu-hal/src/vulkan/instance.rs | 2 +- wgpu-hal/src/vulkan/mod.rs | 6 +----- wgpu-types/src/counters.rs | 5 ++++- wgpu-types/src/lib.rs | 8 ++++---- 63 files changed, 86 insertions(+), 134 deletions(-) diff --git a/naga/src/arena/handlevec.rs b/naga/src/arena/handlevec.rs index 2ddb65c9a4..9b4ed58363 100644 --- a/naga/src/arena/handlevec.rs +++ b/naga/src/arena/handlevec.rs @@ -33,7 +33,6 @@ impl Default for HandleVec { } } -#[allow(dead_code)] impl HandleVec { pub(crate) const fn new() -> Self { Self { diff --git a/naga/src/arena/mod.rs b/naga/src/arena/mod.rs index 8bd3fb84cf..4254325f4f 100644 --- a/naga/src/arena/mod.rs +++ b/naga/src/arena/mod.rs @@ -77,7 +77,6 @@ impl Arena { } /// Extracts the inner vector. - #[allow(clippy::missing_const_for_fn)] // ignore due to requirement of #![feature(const_precise_live_drops)] pub fn into_inner(self) -> Vec { self.data } diff --git a/naga/src/back/glsl/mod.rs b/naga/src/back/glsl/mod.rs index 0798fac82d..713692bf06 100644 --- a/naga/src/back/glsl/mod.rs +++ b/naga/src/back/glsl/mod.rs @@ -4200,7 +4200,7 @@ impl<'a, W: Write> Writer<'a, W> { } /// Helper method for writing an `ImageLoad` expression. - #[allow(clippy::too_many_arguments)] + #[expect(clippy::too_many_arguments)] fn write_image_load( &mut self, handle: Handle, diff --git a/naga/src/back/hlsl/mod.rs b/naga/src/back/hlsl/mod.rs index a5c795c85e..ad53640ffb 100644 --- a/naga/src/back/hlsl/mod.rs +++ b/naga/src/back/hlsl/mod.rs @@ -153,7 +153,6 @@ pub struct OffsetsBindTarget { pub type BindingMap = std::collections::BTreeMap; /// A HLSL shader model version. -#[allow(non_snake_case, non_camel_case_types)] #[derive(Copy, Clone, Debug, Hash, Eq, PartialEq, PartialOrd)] #[cfg_attr(feature = "serialize", derive(serde::Serialize))] #[cfg_attr(feature = "deserialize", derive(serde::Deserialize))] diff --git a/naga/src/back/msl/sampler.rs b/naga/src/back/msl/sampler.rs index 0bf987076d..264cc6100c 100644 --- a/naga/src/back/msl/sampler.rs +++ b/naga/src/back/msl/sampler.rs @@ -156,8 +156,6 @@ pub struct InlineSampler { impl Eq for InlineSampler {} -#[allow(renamed_and_removed_lints)] -#[allow(clippy::derive_hash_xor_eq)] impl std::hash::Hash for InlineSampler { fn hash(&self, hasher: &mut H) { self.coord.hash(hasher); diff --git a/naga/src/back/msl/writer.rs b/naga/src/back/msl/writer.rs index 546a8cf829..dafa0e433c 100644 --- a/naga/src/back/msl/writer.rs +++ b/naga/src/back/msl/writer.rs @@ -691,7 +691,6 @@ impl Writer { /// Finishes writing and returns the output. // See https://github.com/rust-lang/rust-clippy/issues/4979. - #[allow(clippy::missing_const_for_fn)] pub fn finish(self) -> W { self.out } @@ -1404,7 +1403,7 @@ impl Writer { ) } - #[allow(clippy::too_many_arguments)] + #[expect(clippy::too_many_arguments)] fn put_possibly_const_expression( &mut self, expr_handle: Handle, @@ -2505,7 +2504,6 @@ impl Writer { /// [`ReadZeroSkipWrite`]: index::BoundsCheckPolicy::ReadZeroSkipWrite /// [`Store`]: crate::Statement::Store /// [`Load`]: crate::Expression::Load - #[allow(unused_variables)] fn put_bounds_checks( &mut self, mut chain: Handle, diff --git a/naga/src/back/spv/block.rs b/naga/src/back/spv/block.rs index 1e87e2e6d1..0a74a420f5 100644 --- a/naga/src/back/spv/block.rs +++ b/naga/src/back/spv/block.rs @@ -2119,7 +2119,7 @@ impl BlockContext<'_> { } /// Build the instructions for matrix - matrix column operations - #[allow(clippy::too_many_arguments)] + #[expect(clippy::too_many_arguments)] fn write_matrix_matrix_column_op( &mut self, block: &mut Block, diff --git a/naga/src/back/spv/helpers.rs b/naga/src/back/spv/helpers.rs index 63144abc02..250d740b7b 100644 --- a/naga/src/back/spv/helpers.rs +++ b/naga/src/back/spv/helpers.rs @@ -25,7 +25,7 @@ pub(super) fn str_bytes_to_words(bytes: &[u8]) -> Vec { } /// split a string into chunks and keep utf8 valid -#[allow(unstable_name_collisions)] +#[expect(unstable_name_collisions)] pub(super) fn string_to_byte_chunks(input: &str, limit: usize) -> Vec<&[u8]> { let mut offset: usize = 0; let mut start: usize = 0; diff --git a/naga/src/back/spv/image.rs b/naga/src/back/spv/image.rs index fe4001060e..b69e0d0e77 100644 --- a/naga/src/back/spv/image.rs +++ b/naga/src/back/spv/image.rs @@ -727,7 +727,7 @@ impl BlockContext<'_> { /// Generate code for an `ImageLoad` expression. /// /// The arguments are the components of an `Expression::ImageLoad` variant. - #[allow(clippy::too_many_arguments)] + #[expect(clippy::too_many_arguments)] pub(super) fn write_image_load( &mut self, result_type_id: Word, @@ -807,7 +807,7 @@ impl BlockContext<'_> { /// Generate code for an `ImageSample` expression. /// /// The arguments are the components of an `Expression::ImageSample` variant. - #[allow(clippy::too_many_arguments)] + #[expect(clippy::too_many_arguments)] pub(super) fn write_image_sample( &mut self, result_type_id: Word, diff --git a/naga/src/back/spv/instructions.rs b/naga/src/back/spv/instructions.rs index 38aed8c351..c4dedb25f7 100644 --- a/naga/src/back/spv/instructions.rs +++ b/naga/src/back/spv/instructions.rs @@ -282,7 +282,6 @@ impl super::Instruction { instruction } - #[allow(clippy::too_many_arguments)] pub(super) fn type_image( id: Word, sampled_type_id: Word, @@ -748,7 +747,7 @@ impl super::Instruction { // // Ray Query Instructions // - #[allow(clippy::too_many_arguments)] + #[expect(clippy::too_many_arguments)] pub(super) fn ray_query_initialize( query: Word, acceleration_structure: Word, diff --git a/naga/src/back/spv/layout.rs b/naga/src/back/spv/layout.rs index 39117a3d2a..8e6c5ade13 100644 --- a/naga/src/back/spv/layout.rs +++ b/naga/src/back/spv/layout.rs @@ -82,14 +82,12 @@ impl Instruction { } } - #[allow(clippy::panic)] pub(super) fn set_type(&mut self, id: Word) { assert!(self.type_id.is_none(), "Type can only be set once"); self.type_id = Some(id); self.wc += 1; } - #[allow(clippy::panic)] pub(super) fn set_result(&mut self, id: Word) { assert!(self.result_id.is_none(), "Result can only be set once"); self.result_id = Some(id); diff --git a/naga/src/back/wgsl/writer.rs b/naga/src/back/wgsl/writer.rs index a7cd8f95c9..ba73abd958 100644 --- a/naga/src/back/wgsl/writer.rs +++ b/naga/src/back/wgsl/writer.rs @@ -1963,7 +1963,6 @@ impl Writer { } // See https://github.com/rust-lang/rust-clippy/issues/4979. - #[allow(clippy::missing_const_for_fn)] pub fn finish(self) -> W { self.out } diff --git a/naga/src/block.rs b/naga/src/block.rs index 2e86a928f1..d8b2403b6d 100644 --- a/naga/src/block.rs +++ b/naga/src/block.rs @@ -34,7 +34,6 @@ impl Block { } } - #[allow(unused_variables)] pub fn push(&mut self, end: Statement, span: Span) { self.body.push(end); self.span_info.push(span); diff --git a/naga/src/front/glsl/context.rs b/naga/src/front/glsl/context.rs index b4cb1c874e..6cf9515984 100644 --- a/naga/src/front/glsl/context.rs +++ b/naga/src/front/glsl/context.rs @@ -489,7 +489,7 @@ impl<'a> Context<'a> { vector = pointer; } - #[allow(clippy::needless_range_loop)] + #[expect(clippy::needless_range_loop)] for index in 0..size { let dst = self.add_expression( Expression::AccessIndex { diff --git a/naga/src/front/glsl/functions.rs b/naga/src/front/glsl/functions.rs index 0d05c5433c..8554c879c8 100644 --- a/naga/src/front/glsl/functions.rs +++ b/naga/src/front/glsl/functions.rs @@ -200,7 +200,7 @@ impl Frontend { }) } - #[allow(clippy::too_many_arguments)] + #[expect(clippy::too_many_arguments)] fn matrix_one_arg( &mut self, ctx: &mut Context, @@ -348,7 +348,6 @@ impl Frontend { ctx.add_expression(Expression::Compose { ty, components }, meta) } - #[allow(clippy::too_many_arguments)] fn vector_constructor( &mut self, ctx: &mut Context, @@ -506,7 +505,6 @@ impl Frontend { ctx.add_expression(Expression::Compose { ty, components }, meta) } - #[allow(clippy::too_many_arguments)] fn function_call( &mut self, ctx: &mut Context, @@ -868,7 +866,7 @@ impl Frontend { /// Processes a function call argument that appears in place of an output /// parameter. - #[allow(clippy::too_many_arguments)] + #[expect(clippy::too_many_arguments)] fn process_lhs_argument( &mut self, ctx: &mut Context, diff --git a/naga/src/front/spv/image.rs b/naga/src/front/spv/image.rs index ace97d4dd5..fd47052f17 100644 --- a/naga/src/front/spv/image.rs +++ b/naga/src/front/spv/image.rs @@ -482,7 +482,7 @@ impl> super::Frontend { Ok(()) } - #[allow(clippy::too_many_arguments)] + #[expect(clippy::too_many_arguments)] pub(super) fn parse_image_sample( &mut self, mut words_left: u16, diff --git a/naga/src/front/spv/mod.rs b/naga/src/front/spv/mod.rs index b8087fc8b0..256312d472 100644 --- a/naga/src/front/spv/mod.rs +++ b/naga/src/front/spv/mod.rs @@ -1039,7 +1039,7 @@ impl> Frontend { /// A more complicated version of the binary op, /// where we force the operand to have the same type as the result. /// This is mostly needed for "i++" and "i--" coming from GLSL. - #[allow(clippy::too_many_arguments)] + #[expect(clippy::too_many_arguments)] fn parse_expr_binary_op_sign_adjusted( &mut self, ctx: &mut BlockContext, @@ -1117,7 +1117,7 @@ impl> Frontend { /// A version of the binary op where one or both of the arguments might need to be casted to a /// specific integer kind (unsigned or signed), used for operations like OpINotEqual or /// OpUGreaterThan. - #[allow(clippy::too_many_arguments)] + #[expect(clippy::too_many_arguments)] fn parse_expr_int_comparison( &mut self, ctx: &mut BlockContext, @@ -1265,7 +1265,7 @@ impl> Frontend { Ok(()) } - #[allow(clippy::too_many_arguments)] + #[expect(clippy::too_many_arguments)] fn insert_composite( &self, root_expr: Handle, @@ -1389,7 +1389,7 @@ impl> Frontend { Ok((p_lexp_handle, p_base_ty.handle)) } - #[allow(clippy::too_many_arguments)] + #[expect(clippy::too_many_arguments)] fn parse_atomic_expr_with_value( &mut self, inst: Instruction, @@ -4390,10 +4390,7 @@ impl> Frontend { overrides: &Arena, ) -> Arena { let mut expressions = Arena::new(); - #[allow(clippy::panic)] - { - assert!(self.lookup_expression.is_empty()); - } + assert!(self.lookup_expression.is_empty()); // register global variables for (&id, var) in self.lookup_variable.iter() { let span = globals.get_span(var.handle); diff --git a/naga/src/front/wgsl/error.rs b/naga/src/front/wgsl/error.rs index 4af9025944..6c64f5cde9 100644 --- a/naga/src/front/wgsl/error.rs +++ b/naga/src/front/wgsl/error.rs @@ -1017,7 +1017,7 @@ impl<'a> Error<'a> { ) .into(), )], - #[allow(irrefutable_let_patterns)] + #[expect(irrefutable_let_patterns)] notes: if let EnableExtension::Unimplemented(kind) = kind { vec![format!( concat!( diff --git a/naga/src/front/wgsl/lower/mod.rs b/naga/src/front/wgsl/lower/mod.rs index d25eb362c1..d69f38084d 100644 --- a/naga/src/front/wgsl/lower/mod.rs +++ b/naga/src/front/wgsl/lower/mod.rs @@ -372,7 +372,7 @@ pub struct ExpressionContext<'source, 'temp, 'out> { } impl<'source, 'temp, 'out> ExpressionContext<'source, 'temp, 'out> { - #[allow(dead_code)] + #[expect(dead_code)] fn as_const(&mut self) -> ExpressionContext<'source, '_, '_> { ExpressionContext { globals: self.globals, diff --git a/naga/src/front/wgsl/parse/directive/enable_extension.rs b/naga/src/front/wgsl/parse/directive/enable_extension.rs index 147ec0b5e0..006f8f1e08 100644 --- a/naga/src/front/wgsl/parse/directive/enable_extension.rs +++ b/naga/src/front/wgsl/parse/directive/enable_extension.rs @@ -13,14 +13,14 @@ impl EnableExtensions { } /// Add an enable-extension to the set requested by a module. - #[allow(unreachable_code)] + #[expect(unreachable_code)] pub(crate) fn add(&mut self, ext: ImplementedEnableExtension) { let _field: &mut bool = match ext {}; *_field = true; } /// Query whether an enable-extension tracked here has been requested. - #[allow(unused)] + #[expect(unused)] pub(crate) const fn contains(&self, ext: ImplementedEnableExtension) -> bool { match ext {} } @@ -37,7 +37,7 @@ impl Default for EnableExtensions { /// WGSL spec.: #[derive(Clone, Copy, Debug, Hash, Eq, PartialEq)] pub enum EnableExtension { - #[allow(unused)] + #[expect(unused)] Implemented(ImplementedEnableExtension), Unimplemented(UnimplementedEnableExtension), } diff --git a/naga/src/front/wgsl/parse/directive/language_extension.rs b/naga/src/front/wgsl/parse/directive/language_extension.rs index 4a48ccd919..2eb663ef70 100644 --- a/naga/src/front/wgsl/parse/directive/language_extension.rs +++ b/naga/src/front/wgsl/parse/directive/language_extension.rs @@ -9,7 +9,6 @@ use strum::VariantArray; /// WGSL spec.: #[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)] pub enum LanguageExtension { - #[allow(unused)] Implemented(ImplementedLanguageExtension), Unimplemented(UnimplementedLanguageExtension), } diff --git a/naga/src/front/wgsl/parse/lexer.rs b/naga/src/front/wgsl/parse/lexer.rs index 0b0b6edebc..02d1f5b20c 100644 --- a/naga/src/front/wgsl/parse/lexer.rs +++ b/naga/src/front/wgsl/parse/lexer.rs @@ -218,7 +218,6 @@ pub(in crate::front::wgsl) struct Lexer<'a> { /// statements. last_end_offset: usize, - #[allow(dead_code)] pub(in crate::front::wgsl) enable_extensions: EnableExtensions, } diff --git a/naga/src/lib.rs b/naga/src/lib.rs index e326054924..fb5a68d12e 100644 --- a/naga/src/lib.rs +++ b/naga/src/lib.rs @@ -366,7 +366,7 @@ pub enum ConservativeDepth { #[cfg_attr(feature = "serialize", derive(Serialize))] #[cfg_attr(feature = "deserialize", derive(Deserialize))] #[cfg_attr(feature = "arbitrary", derive(Arbitrary))] -#[allow(missing_docs)] // The names are self evident +#[expect(missing_docs)] // The names are self evident pub enum ShaderStage { Vertex, Fragment, @@ -1759,7 +1759,7 @@ pub enum RayQueryFunction { /// [`AccelerationStructure`]: TypeInner::AccelerationStructure acceleration_structure: Handle, - #[allow(rustdoc::private_intra_doc_links)] + #[expect(rustdoc::private_intra_doc_links)] /// A struct of detailed parameters for the ray query. /// /// This expression should have the struct type given in diff --git a/naga/src/proc/constant_evaluator.rs b/naga/src/proc/constant_evaluator.rs index c8911077b7..7c2fd24b4d 100644 --- a/naga/src/proc/constant_evaluator.rs +++ b/naga/src/proc/constant_evaluator.rs @@ -164,7 +164,7 @@ macro_rules! gen_component_wise_extractor { with_dollar_sign! { ($d:tt) => { - #[allow(unused)] + #[allow(clippy::allow_attributes, unused)] #[doc = concat!( "A convenience macro for using the same RHS for each [`", stringify!($target), @@ -1259,7 +1259,7 @@ impl<'a> ConstantEvaluator<'a> { // bits crate::MathFunction::CountTrailingZeros => { component_wise_concrete_int!(self, span, [arg], |e| { - #[allow(clippy::useless_conversion)] + #[allow(clippy::allow_attributes, clippy::useless_conversion)] Ok([e .trailing_zeros() .try_into() @@ -1268,7 +1268,7 @@ impl<'a> ConstantEvaluator<'a> { } crate::MathFunction::CountLeadingZeros => { component_wise_concrete_int!(self, span, [arg], |e| { - #[allow(clippy::useless_conversion)] + #[allow(clippy::allow_attributes, clippy::useless_conversion)] Ok([e .leading_zeros() .try_into() @@ -1277,7 +1277,7 @@ impl<'a> ConstantEvaluator<'a> { } crate::MathFunction::CountOneBits => { component_wise_concrete_int!(self, span, [arg], |e| { - #[allow(clippy::useless_conversion)] + #[allow(clippy::allow_attributes, clippy::useless_conversion)] Ok([e .count_ones() .try_into() diff --git a/naga/src/proc/emitter.rs b/naga/src/proc/emitter.rs index 0df804fff2..6778dae8d6 100644 --- a/naga/src/proc/emitter.rs +++ b/naga/src/proc/emitter.rs @@ -1,13 +1,11 @@ use crate::arena::Arena; /// Helper class to emit expressions -#[allow(dead_code)] #[derive(Default, Debug)] pub struct Emitter { start_len: Option, } -#[allow(dead_code)] impl Emitter { pub fn start(&mut self, arena: &Arena) { if self.start_len.is_some() { @@ -25,7 +23,6 @@ impl Emitter { ) -> Option<(crate::Statement, crate::span::Span)> { let start_len = self.start_len.take().unwrap(); if start_len != arena.len() { - #[allow(unused_mut)] let mut span = crate::span::Span::default(); let range = arena.range_from(start_len); for handle in range.clone() { diff --git a/naga/src/proc/layouter.rs b/naga/src/proc/layouter.rs index 82b1be094a..bb9e68e47a 100644 --- a/naga/src/proc/layouter.rs +++ b/naga/src/proc/layouter.rs @@ -162,7 +162,7 @@ impl Layouter { /// end can call this function at any time, passing its current type and /// constant arenas, and then assume that layouts are available for all /// types. - #[allow(clippy::or_fun_call)] + #[expect(clippy::or_fun_call)] pub fn update(&mut self, gctx: super::GlobalCtx) -> Result<(), LayoutError> { use crate::TypeInner as Ti; diff --git a/naga/src/proc/mod.rs b/naga/src/proc/mod.rs index a6a19f70ed..e795f83889 100644 --- a/naga/src/proc/mod.rs +++ b/naga/src/proc/mod.rs @@ -411,7 +411,6 @@ pub struct GlobalCtx<'a> { impl GlobalCtx<'_> { /// Try to evaluate the expression in `self.global_expressions` using its `handle` and return it as a `u32`. - #[allow(dead_code)] pub(super) fn eval_expr_to_u32( &self, handle: crate::Handle, @@ -435,7 +434,6 @@ impl GlobalCtx<'_> { } /// Try to evaluate the expression in the `arena` using its `handle` and return it as a `bool`. - #[allow(dead_code)] pub(super) fn eval_expr_to_bool_from( &self, handle: crate::Handle, @@ -447,7 +445,6 @@ impl GlobalCtx<'_> { } } - #[allow(dead_code)] pub(crate) fn eval_expr_to_literal( &self, handle: crate::Handle, diff --git a/naga/src/span.rs b/naga/src/span.rs index 0256e19dc4..713e6a4052 100644 --- a/naga/src/span.rs +++ b/naga/src/span.rs @@ -171,7 +171,6 @@ impl WithSpan { } /// Reverse of [`Self::new`], discards span information and returns an inner error. - #[allow(clippy::missing_const_for_fn)] // ignore due to requirement of #![feature(const_precise_live_drops)] pub fn into_inner(self) -> E { self.inner } diff --git a/naga/src/valid/analyzer.rs b/naga/src/valid/analyzer.rs index 8417bf77be..73ab565b03 100644 --- a/naga/src/valid/analyzer.rs +++ b/naga/src/valid/analyzer.rs @@ -233,7 +233,6 @@ struct Sampling { #[cfg_attr(feature = "deserialize", derive(serde::Deserialize))] pub struct FunctionInfo { /// Validation flags. - #[allow(dead_code)] flags: ValidationFlags, /// Set of shader stages where calling this function is valid. pub available_stages: ShaderStages, @@ -506,7 +505,7 @@ impl FunctionInfo { /// [`sampling_set`]: FunctionInfo::sampling_set /// [`sampling`]: FunctionInfo::sampling /// [`global_uses`]: FunctionInfo::global_uses - #[allow(clippy::or_fun_call)] + #[expect(clippy::or_fun_call)] fn process_expression( &mut self, handle: Handle, @@ -827,7 +826,7 @@ impl FunctionInfo { /// /// Returns a `NonUniformControlFlow` error if any of the expressions in the block /// require uniformity, but the current flow is non-uniform. - #[allow(clippy::or_fun_call)] + #[expect(clippy::or_fun_call)] fn process_block( &mut self, statements: &crate::Block, diff --git a/naga/src/valid/expression.rs b/naga/src/valid/expression.rs index 9ef3a9edfb..b80c2cf877 100644 --- a/naga/src/valid/expression.rs +++ b/naga/src/valid/expression.rs @@ -180,7 +180,7 @@ struct ExpressionTypeResolver<'a> { impl std::ops::Index> for ExpressionTypeResolver<'_> { type Output = crate::TypeInner; - #[allow(clippy::panic)] + #[expect(clippy::panic)] fn index(&self, handle: Handle) -> &Self::Output { if handle < self.root { self.info[handle].ty.inner_with(self.types) @@ -234,7 +234,7 @@ impl super::Validator { Ok(()) } - #[allow(clippy::too_many_arguments)] + #[expect(clippy::too_many_arguments)] pub(super) fn validate_expression( &self, root: Handle, diff --git a/naga/src/valid/handles.rs b/naga/src/valid/handles.rs index 260d442c79..6fb4b6df74 100644 --- a/naga/src/valid/handles.rs +++ b/naga/src/valid/handles.rs @@ -380,7 +380,7 @@ impl super::Validator { Ok(max_type) } - #[allow(clippy::too_many_arguments)] + #[expect(clippy::too_many_arguments)] fn validate_expression_handles( (handle, expression): (Handle, &crate::Expression), constants: &Arena, diff --git a/naga/src/valid/mod.rs b/naga/src/valid/mod.rs index 906d449362..3f084b40be 100644 --- a/naga/src/valid/mod.rs +++ b/naga/src/valid/mod.rs @@ -269,7 +269,6 @@ pub struct Validator { layouter: Layouter, location_mask: BitSet, ep_resource_bindings: FastHashSet, - #[allow(dead_code)] switch_values: FastHashSet, valid_expression_list: Vec>, valid_expression_set: HandleSet, diff --git a/wgpu-core/src/binding_model.rs b/wgpu-core/src/binding_model.rs index 3ab652abce..f733eb77fa 100644 --- a/wgpu-core/src/binding_model.rs +++ b/wgpu-core/src/binding_model.rs @@ -542,7 +542,6 @@ pub struct BindGroupLayout { /// (derived BGLs) must not be removed. pub(crate) origin: bgl::Origin, pub(crate) exclusive_pipeline: OnceLock, - #[allow(unused)] pub(crate) binding_count_validator: BindingTypeMaxCountValidator, /// The `label` from the descriptor used to create the resource. pub(crate) label: String, diff --git a/wgpu-core/src/command/bind.rs b/wgpu-core/src/command/bind.rs index 2e1ffa030e..62d77348dd 100644 --- a/wgpu-core/src/command/bind.rs +++ b/wgpu-core/src/command/bind.rs @@ -250,7 +250,7 @@ mod compat { .filter_map(|(i, e)| if e.is_active() { Some(i) } else { None }) } - #[allow(clippy::result_large_err)] + #[expect(clippy::result_large_err)] pub fn get_invalid(&self) -> Result<(), (usize, Error)> { for (index, entry) in self.entries.iter().enumerate() { entry.check().map_err(|e| (index, e))?; diff --git a/wgpu-core/src/conv.rs b/wgpu-core/src/conv.rs index 5216ad0f69..42accb56cf 100644 --- a/wgpu-core/src/conv.rs +++ b/wgpu-core/src/conv.rs @@ -29,7 +29,7 @@ pub fn is_valid_copy_dst_texture_format( #[cfg_attr( any(not(target_arch = "wasm32"), target_os = "emscripten"), - allow(unused) + expect(unused) )] pub fn is_valid_external_image_copy_dst_texture_format(format: wgt::TextureFormat) -> bool { use wgt::TextureFormat as Tf; diff --git a/wgpu-core/src/device/global.rs b/wgpu-core/src/device/global.rs index eff2e811be..ec0bf008bb 100644 --- a/wgpu-core/src/device/global.rs +++ b/wgpu-core/src/device/global.rs @@ -242,7 +242,7 @@ impl Global { unsafe { std::ptr::copy_nonoverlapping(data.as_ptr(), mapping.ptr.as_ptr(), data.len()) }; if !mapping.is_coherent { - #[allow(clippy::single_range_in_vec_init)] + #[expect(clippy::single_range_in_vec_init)] unsafe { device .raw() @@ -941,8 +941,6 @@ impl Global { (id, Some(error)) } - // Unsafe-ness of internal calls has little to do with unsafe-ness of this. - #[allow(unused_unsafe)] /// # Safety /// /// This function passes SPIR-V binary to the backend as-is and can potentially result in a diff --git a/wgpu-core/src/device/mod.rs b/wgpu-core/src/device/mod.rs index e9600f72d6..8a998fb8a8 100644 --- a/wgpu-core/src/device/mod.rs +++ b/wgpu-core/src/device/mod.rs @@ -214,7 +214,7 @@ pub(crate) fn map_buffer( }; if !mapping.is_coherent && kind == HostMap::Read { - #[allow(clippy::single_range_in_vec_init)] + #[expect(clippy::single_range_in_vec_init)] unsafe { raw_device.invalidate_mapped_ranges(raw_buffer, &[offset..offset + size]); } diff --git a/wgpu-core/src/device/queue.rs b/wgpu-core/src/device/queue.rs index e4211ef2f0..f8777e38d9 100644 --- a/wgpu-core/src/device/queue.rs +++ b/wgpu-core/src/device/queue.rs @@ -1096,7 +1096,6 @@ impl Queue { // Note that we are required to invalidate all command buffers in both the success and failure paths. // This is why we `continue` and don't early return via `?`. - #[allow(unused_mut)] let mut cmd_buf_data = command_buffer.take_finished(); #[cfg(feature = "trace")] diff --git a/wgpu-core/src/device/resource.rs b/wgpu-core/src/device/resource.rs index 09747137ac..4e2ff35a01 100644 --- a/wgpu-core/src/device/resource.rs +++ b/wgpu-core/src/device/resource.rs @@ -1593,7 +1593,6 @@ impl Device { Ok(module) } - #[allow(unused_unsafe)] pub(crate) unsafe fn create_shader_module_spirv<'a>( self: &Arc, desc: &pipeline::ShaderModuleDescriptor<'a>, diff --git a/wgpu-core/src/device/trace.rs b/wgpu-core/src/device/trace.rs index a5f849cb8c..6c9cc2d228 100644 --- a/wgpu-core/src/device/trace.rs +++ b/wgpu-core/src/device/trace.rs @@ -31,7 +31,7 @@ pub(crate) fn new_render_bundle_encoder_descriptor<'a>( } } -#[allow(clippy::large_enum_variant)] +#[expect(clippy::large_enum_variant)] #[derive(Debug)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] pub enum Action<'a> { diff --git a/wgpu-core/src/hub.rs b/wgpu-core/src/hub.rs index 15d3e3c06b..41bf919ac3 100644 --- a/wgpu-core/src/hub.rs +++ b/wgpu-core/src/hub.rs @@ -140,7 +140,7 @@ impl HubReport { } } -#[allow(rustdoc::private_intra_doc_links)] +#[expect(rustdoc::private_intra_doc_links)] /// All the resources tracked by a [`crate::global::Global`]. /// /// ## Locking diff --git a/wgpu-core/src/id.rs b/wgpu-core/src/id.rs index d2f239ea7b..1d70d09ee9 100644 --- a/wgpu-core/src/id.rs +++ b/wgpu-core/src/id.rs @@ -87,7 +87,7 @@ impl RawId { pub struct Id(RawId, PhantomData); // This type represents Id in a more readable (and editable) way. -#[allow(dead_code)] +#[cfg_attr(not(feature = "serde"), expect(dead_code))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] enum SerialId { // The only variant forces RON to not ignore "Id" diff --git a/wgpu-core/src/init_tracker/mod.rs b/wgpu-core/src/init_tracker/mod.rs index 15a79bf520..ec0c86c608 100644 --- a/wgpu-core/src/init_tracker/mod.rs +++ b/wgpu-core/src/init_tracker/mod.rs @@ -247,7 +247,6 @@ where impl InitTracker { // Makes a single entry uninitialized if not already uninitialized - #[allow(dead_code)] pub(crate) fn discard(&mut self, pos: u32) { // first range where end>=idx let r_idx = self.uninitialized_ranges.partition_point(|r| r.end < pos); diff --git a/wgpu-core/src/instance.rs b/wgpu-core/src/instance.rs index c19a51d58e..279da5e6da 100644 --- a/wgpu-core/src/instance.rs +++ b/wgpu-core/src/instance.rs @@ -55,7 +55,6 @@ fn downlevel_default_limits_less_than_default_limits() { #[derive(Default)] pub struct Instance { - #[allow(dead_code)] pub name: String, /// List of instances per backend. /// @@ -611,7 +610,6 @@ impl Adapter { } } - #[allow(clippy::type_complexity)] fn create_device_and_queue_from_hal( self: &Arc, hal_device: hal::DynOpenDevice, diff --git a/wgpu-core/src/lock/mod.rs b/wgpu-core/src/lock/mod.rs index 2927bf3aaf..f52617bb98 100644 --- a/wgpu-core/src/lock/mod.rs +++ b/wgpu-core/src/lock/mod.rs @@ -33,13 +33,13 @@ pub mod rank; -#[cfg_attr(not(wgpu_validate_locks), allow(dead_code))] +#[cfg_attr(not(wgpu_validate_locks), expect(dead_code))] mod ranked; #[cfg(feature = "observe_locks")] mod observing; -#[cfg_attr(any(wgpu_validate_locks, feature = "observe_locks"), allow(dead_code))] +#[cfg_attr(any(wgpu_validate_locks, feature = "observe_locks"), expect(dead_code))] mod vanilla; #[cfg(wgpu_validate_locks)] diff --git a/wgpu-core/src/lock/observing.rs b/wgpu-core/src/lock/observing.rs index c530a56539..8ad9437fc9 100644 --- a/wgpu-core/src/lock/observing.rs +++ b/wgpu-core/src/lock/observing.rs @@ -336,7 +336,7 @@ struct ObservationLog { buffer: Vec, } -#[allow(trivial_casts)] +#[expect(trivial_casts)] impl ObservationLog { /// Create an observation log in `dir` for the current pid and thread. fn create(dir: impl AsRef) -> Result { diff --git a/wgpu-core/src/lock/rank.rs b/wgpu-core/src/lock/rank.rs index 652165ebda..342dc1b195 100644 --- a/wgpu-core/src/lock/rank.rs +++ b/wgpu-core/src/lock/rank.rs @@ -49,7 +49,7 @@ macro_rules! define_lock_ranks { )* } => { // An enum that assigns a unique number to each rank. - #[allow(non_camel_case_types, clippy::upper_case_acronyms)] + #[expect(non_camel_case_types, clippy::upper_case_acronyms)] enum LockRankNumber { $( $name, )* } bitflags::bitflags! { @@ -72,7 +72,7 @@ macro_rules! define_lock_ranks { } } - #[cfg_attr(not(feature = "observe_locks"), allow(dead_code))] + #[cfg_attr(not(feature = "observe_locks"), expect(dead_code))] pub fn const_name(self) -> &'static str { match self { $( @@ -132,7 +132,6 @@ define_lock_ranks! { rank BUFFER_INITIALIZATION_STATUS "Buffer::initialization_status" followed by { } rank DEVICE_DEFERRED_DESTROY "Device::deferred_destroy" followed by { } rank DEVICE_FENCE "Device::fence" followed by { } - #[allow(dead_code)] rank DEVICE_TRACE "Device::trace" followed by { } rank DEVICE_TRACKERS "Device::trackers" followed by { } rank DEVICE_LOST_CLOSURE "Device::device_lost_closure" followed by { } diff --git a/wgpu-core/src/pipeline.rs b/wgpu-core/src/pipeline.rs index 32e2378029..45a382b640 100644 --- a/wgpu-core/src/pipeline.rs +++ b/wgpu-core/src/pipeline.rs @@ -21,7 +21,7 @@ pub(crate) struct LateSizedBufferGroup { pub(crate) shader_sizes: Vec, } -#[allow(clippy::large_enum_variant)] +#[expect(clippy::large_enum_variant)] pub enum ShaderModuleSource<'a> { #[cfg(feature = "wgsl")] Wgsl(Cow<'a, str>), diff --git a/wgpu-core/src/resource.rs b/wgpu-core/src/resource.rs index 73435fc312..1a4c12adb8 100644 --- a/wgpu-core/src/resource.rs +++ b/wgpu-core/src/resource.rs @@ -677,7 +677,6 @@ impl Buffer { range, host, } => { - #[allow(clippy::collapsible_if)] if host == HostMap::Write { #[cfg(feature = "trace")] if let Some(ref mut trace) = *device.trace.lock() { @@ -929,7 +928,7 @@ impl StagingBuffer { pub(crate) fn flush(self) -> FlushedStagingBuffer { let device = self.device.raw(); if !self.is_coherent { - #[allow(clippy::single_range_in_vec_init)] + #[expect(clippy::single_range_in_vec_init)] unsafe { device.flush_mapped_ranges(self.raw.as_ref(), &[0..self.size.get()]) }; diff --git a/wgpu-core/src/validation.rs b/wgpu-core/src/validation.rs index 2fd1e14959..026f0522f3 100644 --- a/wgpu-core/src/validation.rs +++ b/wgpu-core/src/validation.rs @@ -54,7 +54,7 @@ impl From<&BindingType> for BindingTypeName { #[derive(Debug)] struct Resource { - #[allow(unused)] + #[expect(unused)] name: Option, bind: naga::ResourceBinding, ty: ResourceType, @@ -139,7 +139,7 @@ enum Varying { BuiltIn(naga::BuiltIn), } -#[allow(unused)] +#[expect(unused)] #[derive(Debug)] struct SpecializationConstant { id: u32, @@ -151,7 +151,7 @@ struct EntryPoint { inputs: Vec, outputs: Vec, resources: Vec>, - #[allow(unused)] + #[expect(unused)] spec_constants: Vec, sampling_pairs: FastHashSet<(naga::Handle, naga::Handle)>, workgroup_size: [u32; 3], diff --git a/wgpu-hal/src/gles/command.rs b/wgpu-hal/src/gles/command.rs index 00e7a845cd..1f6ea5ebad 100644 --- a/wgpu-hal/src/gles/command.rs +++ b/wgpu-hal/src/gles/command.rs @@ -223,7 +223,6 @@ impl super::CommandEncoder { } } - #[allow(clippy::clone_on_copy)] // False positive when cloning glow::UniformLocation fn set_pipeline_inner(&mut self, inner: &super::PipelineInner) { self.cmd_buffer.commands.push(C::SetProgram(inner.program)); @@ -1035,7 +1034,7 @@ impl crate::CommandEncoder for super::CommandEncoder { instance_count: u32, ) { self.prepare_draw(first_instance); - #[allow(clippy::clone_on_copy)] // False positive when cloning glow::UniformLocation + #[expect(clippy::clone_on_copy)] // False positive when cloning glow::UniformLocation self.cmd_buffer.commands.push(C::Draw { topology: self.state.topology, first_vertex, @@ -1059,7 +1058,7 @@ impl crate::CommandEncoder for super::CommandEncoder { wgt::IndexFormat::Uint32 => (4, glow::UNSIGNED_INT), }; let index_offset = self.state.index_offset + index_size * first_index as wgt::BufferAddress; - #[allow(clippy::clone_on_copy)] // False positive when cloning glow::UniformLocation + #[expect(clippy::clone_on_copy)] // False positive when cloning glow::UniformLocation self.cmd_buffer.commands.push(C::DrawIndexed { topology: self.state.topology, index_type, @@ -1081,7 +1080,7 @@ impl crate::CommandEncoder for super::CommandEncoder { for draw in 0..draw_count as wgt::BufferAddress { let indirect_offset = offset + draw * size_of::() as wgt::BufferAddress; - #[allow(clippy::clone_on_copy)] // False positive when cloning glow::UniformLocation + #[expect(clippy::clone_on_copy)] // False positive when cloning glow::UniformLocation self.cmd_buffer.commands.push(C::DrawIndirect { topology: self.state.topology, indirect_buf: buffer.raw.unwrap(), @@ -1104,7 +1103,7 @@ impl crate::CommandEncoder for super::CommandEncoder { for draw in 0..draw_count as wgt::BufferAddress { let indirect_offset = offset + draw * size_of::() as wgt::BufferAddress; - #[allow(clippy::clone_on_copy)] // False positive when cloning glow::UniformLocation + #[expect(clippy::clone_on_copy)] // False positive when cloning glow::UniformLocation self.cmd_buffer.commands.push(C::DrawIndexedIndirect { topology: self.state.topology, index_type, diff --git a/wgpu-hal/src/gles/device.rs b/wgpu-hal/src/gles/device.rs index a9d6209afb..47443ddfcf 100644 --- a/wgpu-hal/src/gles/device.rs +++ b/wgpu-hal/src/gles/device.rs @@ -1569,7 +1569,7 @@ impl crate::Device for super::Device { self.render_doc .start_frame_capture(self.shared.context.raw_context(), ptr::null_mut()) }; - #[allow(unreachable_code)] + #[cfg(not(all(native, feature = "renderdoc")))] false } unsafe fn stop_capture(&self) { diff --git a/wgpu-hal/src/gles/egl.rs b/wgpu-hal/src/gles/egl.rs index f2e4f1d952..c3613ead43 100644 --- a/wgpu-hal/src/gles/egl.rs +++ b/wgpu-hal/src/gles/egl.rs @@ -61,7 +61,7 @@ type WlEglWindowDestroyFun = unsafe extern "system" fn(window: *const raw::c_voi type EglLabel = *const raw::c_void; -#[allow(clippy::upper_case_acronyms)] +#[expect(clippy::upper_case_acronyms)] type EGLDEBUGPROCKHR = Option< unsafe extern "system" fn( error: khronos_egl::Enum, @@ -460,7 +460,6 @@ struct Inner { /// Note: the context contains a dummy pbuffer (1x1). /// Required for `eglMakeCurrent` on platforms that doesn't supports `EGL_KHR_surfaceless_context`. egl: EglContext, - #[allow(unused)] version: (i32, i32), supports_native_window: bool, config: khronos_egl::Config, @@ -893,7 +892,7 @@ impl crate::Instance for Instance { (display, Some(Rc::new(display_owner)), WindowKind::AngleX11) } else if client_ext_str.contains("EGL_MESA_platform_surfaceless") { log::warn!("No windowing system present. Using surfaceless platform"); - #[allow(clippy::unnecessary_literal_unwrap)] // This is only a literal on Emscripten + #[cfg_attr(Emscripten, expect(clippy::unnecessary_literal_unwrap))] let egl = egl1_5.expect("Failed to get EGL 1.5 for surfaceless"); let display = unsafe { egl.get_platform_display( @@ -951,7 +950,6 @@ impl crate::Instance for Instance { }) } - #[cfg_attr(target_os = "macos", allow(unused, unused_mut, unreachable_code))] unsafe fn create_surface( &self, display_handle: raw_window_handle::RawDisplayHandle, @@ -959,7 +957,7 @@ impl crate::Instance for Instance { ) -> Result { use raw_window_handle::RawWindowHandle as Rwh; - #[cfg_attr(any(target_os = "android", Emscripten), allow(unused_mut))] + #[cfg_attr(any(target_os = "android", Emscripten), expect(unused_mut))] let mut inner = self.inner.lock(); match (window_handle, display_handle) { @@ -1167,7 +1165,7 @@ pub struct Swapchain { extent: wgt::Extent3d, format: wgt::TextureFormat, format_desc: super::TextureFormatDesc, - #[allow(unused)] + #[expect(unused)] sample_type: wgt::TextureSampleType, } diff --git a/wgpu-hal/src/gles/mod.rs b/wgpu-hal/src/gles/mod.rs index 478f2c433c..2e5fc73f51 100644 --- a/wgpu-hal/src/gles/mod.rs +++ b/wgpu-hal/src/gles/mod.rs @@ -394,7 +394,6 @@ pub struct Texture { pub mip_level_count: u32, pub array_layer_count: u32, pub format: wgt::TextureFormat, - #[allow(unused)] pub format_desc: TextureFormatDesc, pub copy_size: CopyExtent, } @@ -868,7 +867,7 @@ enum Command { }, CopyBufferToTexture { src: Buffer, - #[allow(unused)] + #[expect(unused)] src_target: BindTarget, dst: glow::Texture, dst_target: BindTarget, @@ -880,7 +879,7 @@ enum Command { src_target: BindTarget, src_format: wgt::TextureFormat, dst: Buffer, - #[allow(unused)] + #[expect(unused)] dst_target: BindTarget, copy: crate::BufferTextureCopy, }, diff --git a/wgpu-hal/src/lib.rs b/wgpu-hal/src/lib.rs index 051c6eb63f..22e131bc56 100644 --- a/wgpu-hal/src/lib.rs +++ b/wgpu-hal/src/lib.rs @@ -352,13 +352,13 @@ pub enum DeviceError { Unexpected, } -#[allow(dead_code)] // may be unused on some platforms +#[cfg_attr(not(any(vulkan, dx12)), expect(dead_code))] #[cold] fn hal_usage_error(txt: T) -> ! { panic!("wgpu-hal invariant was violated (usage error): {txt}") } -#[allow(dead_code)] // may be unused on some platforms +#[cfg_attr(not(dx12), expect(dead_code))] #[cold] fn hal_internal_error(txt: T) -> ! { panic!("wgpu-hal ran into a preventable internal error: {txt}") @@ -420,14 +420,14 @@ pub struct InstanceError { } impl InstanceError { - #[allow(dead_code)] // may be unused on some platforms + #[cfg_attr(not(native), expect(dead_code))] pub(crate) fn new(message: String) -> Self { Self { message, source: None, } } - #[allow(dead_code)] // may be unused on some platforms + #[cfg_attr(not(native), expect(dead_code))] pub(crate) fn with_source( message: String, source: impl std::error::Error + Send + Sync + 'static, @@ -858,7 +858,7 @@ pub trait Device: WasmNotSendSync { ) -> Result<::PipelineLayout, DeviceError>; unsafe fn destroy_pipeline_layout(&self, pipeline_layout: ::PipelineLayout); - #[allow(clippy::type_complexity)] + #[expect(clippy::type_complexity)] unsafe fn create_bind_group( &self, desc: &BindGroupDescriptor< @@ -878,7 +878,7 @@ pub trait Device: WasmNotSendSync { ) -> Result<::ShaderModule, ShaderError>; unsafe fn destroy_shader_module(&self, module: ::ShaderModule); - #[allow(clippy::type_complexity)] + #[expect(clippy::type_complexity)] unsafe fn create_render_pipeline( &self, desc: &RenderPipelineDescriptor< @@ -889,7 +889,7 @@ pub trait Device: WasmNotSendSync { ) -> Result<::RenderPipeline, PipelineError>; unsafe fn destroy_render_pipeline(&self, pipeline: ::RenderPipeline); - #[allow(clippy::type_complexity)] + #[expect(clippy::type_complexity)] unsafe fn create_compute_pipeline( &self, desc: &ComputePipelineDescriptor< @@ -949,7 +949,7 @@ pub trait Device: WasmNotSendSync { unsafe fn start_capture(&self) -> bool; unsafe fn stop_capture(&self); - #[allow(unused_variables)] + #[expect(unused_variables)] unsafe fn pipeline_cache_get_data( &self, cache: &::PipelineCache, @@ -2014,7 +2014,6 @@ impl fmt::Debug for NagaShader { } /// Shader input. -#[allow(clippy::large_enum_variant)] pub enum ShaderInput<'a> { Naga(NagaShader), SpirV(&'a [u32]), @@ -2289,7 +2288,7 @@ pub struct ValidationCanary { } impl ValidationCanary { - #[allow(dead_code)] // in some configurations this function is dead + #[cfg_attr(not(any(gles, vulkan)), expect(dead_code))] fn add(&self, msg: String) { self.inner.lock().push(msg); } diff --git a/wgpu-hal/src/metal/adapter.rs b/wgpu-hal/src/metal/adapter.rs index dae4cb3322..69ca728bef 100644 --- a/wgpu-hal/src/metal/adapter.rs +++ b/wgpu-hal/src/metal/adapter.rs @@ -511,7 +511,6 @@ impl super::PrivateCapabilities { pub fn new(device: &metal::Device) -> Self { #[repr(C)] #[derive(Clone, Copy, Debug)] - #[allow(clippy::upper_case_acronyms)] struct NSOperatingSystemVersion { major: usize, minor: usize, diff --git a/wgpu-hal/src/metal/mod.rs b/wgpu-hal/src/metal/mod.rs index 8a3ff41bbe..c75d380530 100644 --- a/wgpu-hal/src/metal/mod.rs +++ b/wgpu-hal/src/metal/mod.rs @@ -17,7 +17,7 @@ end of the VS buffer table. // However, `MTLGpuFamily` is only supported starting MacOS 10.15, whereas our minimum target is MacOS 10.13, // See https://github.com/gpuweb/gpuweb/issues/1069 for minimum spec. // TODO: Eventually all deprecated features should be abstracted and use new api when available. -#[allow(deprecated)] +#[expect(deprecated)] mod adapter; mod command; mod conv; @@ -190,7 +190,7 @@ bitflags!( } ); -#[allow(dead_code)] +#[expect(dead_code)] #[derive(Clone, Debug)] struct PrivateCapabilities { family_check: bool, @@ -300,7 +300,7 @@ struct PrivateDisabilities { /// Near depth is not respected properly on some Intel GPUs. broken_viewport_near_depth: bool, /// Multi-target clears don't appear to work properly on Intel GPUs. - #[allow(dead_code)] + #[expect(dead_code)] broken_layered_clear_image: bool, } @@ -816,9 +816,8 @@ impl PipelineStageInfo { #[derive(Debug)] pub struct RenderPipeline { raw: metal::RenderPipelineState, - #[allow(dead_code)] + #[expect(dead_code)] vs_lib: metal::Library, - #[allow(dead_code)] fs_lib: Option, vs_info: PipelineStageInfo, fs_info: Option, @@ -838,7 +837,7 @@ impl crate::DynRenderPipeline for RenderPipeline {} #[derive(Debug)] pub struct ComputePipeline { raw: metal::ComputePipelineState, - #[allow(dead_code)] + #[expect(dead_code)] cs_lib: metal::Library, cs_info: PipelineStageInfo, work_group_size: metal::MTLSize, diff --git a/wgpu-hal/src/metal/surface.rs b/wgpu-hal/src/metal/surface.rs index 5f4bcaeb81..b23d79f1a4 100644 --- a/wgpu-hal/src/metal/surface.rs +++ b/wgpu-hal/src/metal/surface.rs @@ -22,7 +22,6 @@ use parking_lot::{Mutex, RwLock}; #[link(name = "QuartzCore", kind = "framework")] extern "C" { - #[allow(non_upper_case_globals)] static kCAGravityResize: *mut Object; } @@ -73,7 +72,6 @@ impl super::Surface { } /// If not called on the main thread, this will panic. - #[allow(clippy::transmute_ptr_to_ref)] pub unsafe fn from_view(view: NonNull) -> Self { let layer = unsafe { Self::get_metal_layer(view) }; let layer = ManuallyDrop::new(layer); diff --git a/wgpu-hal/src/vulkan/adapter.rs b/wgpu-hal/src/vulkan/adapter.rs index 61020c2a34..3356c64734 100644 --- a/wgpu-hal/src/vulkan/adapter.rs +++ b/wgpu-hal/src/vulkan/adapter.rs @@ -1712,7 +1712,7 @@ impl super::Adapter { /// - `enabled_extensions` must be a superset of `required_device_extensions()`. /// - If `drop_callback` is [`None`], wgpu-hal will take ownership of `raw_device`. If /// `drop_callback` is [`Some`], `raw_device` must be valid until the callback is called. - #[allow(clippy::too_many_arguments)] + #[expect(clippy::too_many_arguments)] pub unsafe fn device_from_raw( &self, raw_device: ash::Device, diff --git a/wgpu-hal/src/vulkan/instance.rs b/wgpu-hal/src/vulkan/instance.rs index 02e1b34a43..037278d7f7 100644 --- a/wgpu-hal/src/vulkan/instance.rs +++ b/wgpu-hal/src/vulkan/instance.rs @@ -322,7 +322,7 @@ impl super::Instance { /// /// If `debug_utils_user_data` is `Some`, then the validation layer is /// available, so create a [`vk::DebugUtilsMessengerEXT`]. - #[allow(clippy::too_many_arguments)] + #[expect(clippy::too_many_arguments)] pub unsafe fn from_raw( entry: ash::Entry, raw_instance: ash::Instance, diff --git a/wgpu-hal/src/vulkan/mod.rs b/wgpu-hal/src/vulkan/mod.rs index 4421d0a5ef..94a1c2252d 100644 --- a/wgpu-hal/src/vulkan/mod.rs +++ b/wgpu-hal/src/vulkan/mod.rs @@ -116,7 +116,7 @@ struct DebugUtils { /// `InstanceShared::drop` destroys the debug messenger before /// dropping this, so the callback should never receive a dangling /// user data pointer. - #[allow(dead_code)] + #[expect(dead_code)] callback_data: Box, } @@ -975,7 +975,6 @@ pub struct CommandBuffer { impl crate::DynCommandBuffer for CommandBuffer {} #[derive(Debug)] -#[allow(clippy::large_enum_variant)] pub enum ShaderModule { Raw(vk::ShaderModule), Intermediate { @@ -1452,7 +1451,6 @@ fn get_unexpected_err(_err: vk::Result) -> crate::DeviceError { #[cfg(feature = "internal_error_panic")] panic!("Unexpected Vulkan error: {_err:?}"); - #[allow(unreachable_code)] crate::DeviceError::Unexpected } @@ -1462,7 +1460,6 @@ fn get_oom_err(_err: vk::Result) -> crate::DeviceError { #[cfg(feature = "oom_panic")] panic!("Out of memory ({_err:?})"); - #[allow(unreachable_code)] crate::DeviceError::OutOfMemory } @@ -1472,7 +1469,6 @@ fn get_lost_err() -> crate::DeviceError { #[cfg(feature = "device_lost_panic")] panic!("Device lost"); - #[allow(unreachable_code)] crate::DeviceError::Lost } diff --git a/wgpu-types/src/counters.rs b/wgpu-types/src/counters.rs index ff38b33c66..08ed4e40b4 100644 --- a/wgpu-types/src/counters.rs +++ b/wgpu-types/src/counters.rs @@ -103,7 +103,10 @@ impl core::fmt::Debug for InternalCounter { } /// `wgpu-hal`'s internal counters. -#[allow(missing_docs)] +#[expect( + missing_docs, + reason = "We don't feel the need to document individual fields here." +)] #[derive(Clone, Default)] pub struct HalCounters { // API objects diff --git a/wgpu-types/src/lib.rs b/wgpu-types/src/lib.rs index a8ae5a8d54..9ef10c5003 100644 --- a/wgpu-types/src/lib.rs +++ b/wgpu-types/src/lib.rs @@ -1537,7 +1537,7 @@ impl Limits { #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] pub struct DownlevelLimits {} -#[allow(clippy::derivable_impls)] +#[expect(clippy::derivable_impls)] impl Default for DownlevelLimits { fn default() -> Self { DownlevelLimits {} @@ -6050,7 +6050,7 @@ pub struct Color { pub a: f64, } -#[allow(missing_docs)] +#[expect(missing_docs)] impl Color { pub const TRANSPARENT: Self = Self { r: 0.0, @@ -6118,9 +6118,9 @@ pub enum TextureDimension { #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] #[cfg_attr(feature = "serde", serde(rename_all = "camelCase"))] pub struct Origin2d { - #[allow(missing_docs)] + #[expect(missing_docs)] pub x: u32, - #[allow(missing_docs)] + #[expect(missing_docs)] pub y: u32, }