Skip to content

Commit

Permalink
FIXUP: ugh yet more lint expectations
Browse files Browse the repository at this point in the history
  • Loading branch information
ErichDonGubler committed Jan 31, 2025
1 parent 5583019 commit 1dd9e4f
Show file tree
Hide file tree
Showing 63 changed files with 87 additions and 133 deletions.
1 change: 0 additions & 1 deletion naga/src/arena/handlevec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ impl<T, U> Default for HandleVec<T, U> {
}
}

#[allow(dead_code)]
impl<T, U> HandleVec<T, U> {
pub(crate) const fn new() -> Self {
Self {
Expand Down
1 change: 0 additions & 1 deletion naga/src/arena/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ impl<T> Arena<T> {
}

/// 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<T> {
self.data
}
Expand Down
2 changes: 1 addition & 1 deletion naga/src/back/glsl/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<crate::Expression>,
Expand Down
1 change: 0 additions & 1 deletion naga/src/back/hlsl/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,6 @@ pub struct OffsetsBindTarget {
pub type BindingMap = std::collections::BTreeMap<crate::ResourceBinding, BindTarget>;

/// 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))]
Expand Down
2 changes: 0 additions & 2 deletions naga/src/back/msl/sampler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<H: std::hash::Hasher>(&self, hasher: &mut H) {
self.coord.hash(hasher);
Expand Down
4 changes: 1 addition & 3 deletions naga/src/back/msl/writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -691,7 +691,6 @@ impl<W: Write> Writer<W> {

/// 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
}
Expand Down Expand Up @@ -1404,7 +1403,7 @@ impl<W: Write> Writer<W> {
)
}

#[allow(clippy::too_many_arguments)]
#[expect(clippy::too_many_arguments)]
fn put_possibly_const_expression<C, I, E>(
&mut self,
expr_handle: Handle<crate::Expression>,
Expand Down Expand Up @@ -2505,7 +2504,6 @@ impl<W: Write> Writer<W> {
/// [`ReadZeroSkipWrite`]: index::BoundsCheckPolicy::ReadZeroSkipWrite
/// [`Store`]: crate::Statement::Store
/// [`Load`]: crate::Expression::Load
#[allow(unused_variables)]
fn put_bounds_checks(
&mut self,
mut chain: Handle<crate::Expression>,
Expand Down
2 changes: 1 addition & 1 deletion naga/src/back/spv/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion naga/src/back/spv/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ pub(super) fn str_bytes_to_words(bytes: &[u8]) -> Vec<Word> {
}

/// 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;
Expand Down
4 changes: 2 additions & 2 deletions naga/src/back/spv/image.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
3 changes: 1 addition & 2 deletions naga/src/back/spv/instructions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,6 @@ impl super::Instruction {
instruction
}

#[allow(clippy::too_many_arguments)]
pub(super) fn type_image(
id: Word,
sampled_type_id: Word,
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 0 additions & 2 deletions naga/src/back/spv/layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 0 additions & 1 deletion naga/src/back/wgsl/writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1963,7 +1963,6 @@ impl<W: Write> Writer<W> {
}

// See https://github.com/rust-lang/rust-clippy/issues/4979.
#[allow(clippy::missing_const_for_fn)]
pub fn finish(self) -> W {
self.out
}
Expand Down
1 change: 0 additions & 1 deletion naga/src/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion naga/src/front/glsl/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
6 changes: 2 additions & 4 deletions naga/src/front/glsl/functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion naga/src/front/spv/image.rs
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@ impl<I: Iterator<Item = u32>> super::Frontend<I> {
Ok(())
}

#[allow(clippy::too_many_arguments)]
#[expect(clippy::too_many_arguments)]
pub(super) fn parse_image_sample(
&mut self,
mut words_left: u16,
Expand Down
13 changes: 5 additions & 8 deletions naga/src/front/spv/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1039,7 +1039,7 @@ impl<I: Iterator<Item = u32>> Frontend<I> {
/// 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,
Expand Down Expand Up @@ -1117,7 +1117,7 @@ impl<I: Iterator<Item = u32>> Frontend<I> {
/// 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,
Expand Down Expand Up @@ -1265,7 +1265,7 @@ impl<I: Iterator<Item = u32>> Frontend<I> {
Ok(())
}

#[allow(clippy::too_many_arguments)]
#[expect(clippy::too_many_arguments)]
fn insert_composite(
&self,
root_expr: Handle<crate::Expression>,
Expand Down Expand Up @@ -1389,7 +1389,7 @@ impl<I: Iterator<Item = u32>> Frontend<I> {
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,
Expand Down Expand Up @@ -4390,10 +4390,7 @@ impl<I: Iterator<Item = u32>> Frontend<I> {
overrides: &Arena<crate::Override>,
) -> Arena<crate::Expression> {
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);
Expand Down
2 changes: 1 addition & 1 deletion naga/src/front/wgsl/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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!(
Expand Down
2 changes: 1 addition & 1 deletion naga/src/front/wgsl/lower/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions naga/src/front/wgsl/parse/directive/enable_extension.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {}
}
Expand All @@ -37,7 +37,7 @@ impl Default for EnableExtensions {
/// WGSL spec.: <https://www.w3.org/TR/WGSL/#enable-extensions-sec>
#[derive(Clone, Copy, Debug, Hash, Eq, PartialEq)]
pub enum EnableExtension {
#[allow(unused)]
#[expect(unused)]
Implemented(ImplementedEnableExtension),
Unimplemented(UnimplementedEnableExtension),
}
Expand Down
1 change: 0 additions & 1 deletion naga/src/front/wgsl/parse/directive/language_extension.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ use strum::VariantArray;
/// WGSL spec.: <https://www.w3.org/TR/WGSL/#language-extensions-sec>
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
pub enum LanguageExtension {
#[allow(unused)]
Implemented(ImplementedLanguageExtension),
Unimplemented(UnimplementedLanguageExtension),
}
Expand Down
1 change: 0 additions & 1 deletion naga/src/front/wgsl/parse/lexer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}

Expand Down
4 changes: 2 additions & 2 deletions naga/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -1759,7 +1759,7 @@ pub enum RayQueryFunction {
/// [`AccelerationStructure`]: TypeInner::AccelerationStructure
acceleration_structure: Handle<Expression>,

#[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
Expand Down
8 changes: 4 additions & 4 deletions naga/src/proc/constant_evaluator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -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()
Expand All @@ -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()
Expand All @@ -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()
Expand Down
3 changes: 0 additions & 3 deletions naga/src/proc/emitter.rs
Original file line number Diff line number Diff line change
@@ -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<usize>,
}

#[allow(dead_code)]
impl Emitter {
pub fn start(&mut self, arena: &Arena<crate::Expression>) {
if self.start_len.is_some() {
Expand All @@ -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() {
Expand Down
2 changes: 1 addition & 1 deletion naga/src/proc/layouter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Loading

0 comments on commit 1dd9e4f

Please sign in to comment.