Skip to content

Commit 70f3bcd

Browse files
committed
Convert comments on lint attributes to reasons.
1 parent 8ddbd2d commit 70f3bcd

File tree

18 files changed

+68
-45
lines changed

18 files changed

+68
-45
lines changed

benches/src/lib.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
#![cfg(not(target_arch = "wasm32"))]
2-
#![expect(clippy::disallowed_types)] // We're outside of the main wgpu codebase
2+
#![expect(
3+
clippy::disallowed_types,
4+
reason = "We're outside of the main wgpu codebase"
5+
)]
36

47
//! Benchmarking framework for `wgpu`.
58
//!
@@ -134,7 +137,7 @@ pub fn main(benchmarks: Vec<Benchmark>) {
134137
// test mode, so we need to accept it.
135138
let _no_capture = args.contains("--no-capture");
136139

137-
#[expect(clippy::manual_map)] // So much clearer this way
140+
#[expect(clippy::manual_map, reason = "So much clearer this way")]
138141
let mut override_iterations = if let Some(iters) = args.opt_value_from_str("--iters").unwrap() {
139142
Some(LoopControl::Iterations(iters))
140143
} else if let Some(seconds) = args.opt_value_from_str("--time").unwrap() {

examples/features/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![allow(clippy::arc_with_non_send_sync)] // False positive on wasm
1+
#![allow(clippy::arc_with_non_send_sync, reason = "False positive on wasm")]
22
#![warn(clippy::allow_attributes)]
33

44
pub mod framework;

naga-test/src/lib.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
// A lot of the code can be unused based on configuration flags,
2-
// the corresponding warnings aren't helpful.
3-
#![allow(dead_code, unused_imports)]
1+
#![allow(
2+
dead_code,
3+
unused_imports,
4+
reason = "A lot of the code can be unused based on configuration flags; \
5+
the corresponding warnings aren't helpful."
6+
)]
47

58
use core::fmt::Write;
69

naga/src/proc/overloads/list.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,9 +162,11 @@ impl crate::proc::overloads::OverloadSet for List {
162162
}
163163

164164
const fn len_to_full_mask(n: usize) -> u64 {
165-
// This is a const function, which _sometimes_ gets called,
166-
// so this lint is _sometimes_ triggered, depending on feature set.
167-
#[expect(clippy::allow_attributes)]
165+
#[expect(
166+
clippy::allow_attributes,
167+
reason = "This is a const function, which _sometimes_ gets called, \
168+
so this lint is _sometimes_ triggered, depending on feature set."
169+
)]
168170
#[allow(clippy::panic)]
169171
if n >= 64 {
170172
panic!("List::rules can only hold up to 63 rules");

naga/src/valid/mod.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -408,9 +408,10 @@ enum TraceRayVertexReturnState {
408408
/// Trace ray calls have been found, at least
409409
/// one uses an acceleration structure that
410410
/// does not have the flag enabling vertex return.
411-
// Don't yet have vertex return builtins to return.
412-
// this error for.
413-
#[expect(unused)]
411+
#[expect(
412+
unused,
413+
reason = "Don't yet have vertex return builtins to return this error for."
414+
)]
414415
NoVertexReturn(crate::Span),
415416
/// Trace ray calls have been found, all
416417
/// acceleration structures have the flag enabling

tests/src/expectations.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ impl FailureReason {
319319
};
320320

321321
/// Match a validation error.
322-
#[allow(dead_code)] // Not constructed on wasm
322+
#[allow(dead_code, reason = "Not constructed on wasm")]
323323
pub fn validation_error() -> Self {
324324
Self {
325325
kind: Some(FailureResultKind::ValidationError),
@@ -364,7 +364,7 @@ pub enum FailureBehavior {
364364

365365
#[derive(Debug, Clone, Copy, PartialEq)]
366366
pub(crate) enum FailureResultKind {
367-
#[allow(dead_code)] // Not constructed on wasm
367+
#[allow(dead_code, reason = "Not constructed on wasm")]
368368
ValidationError,
369369
Panic,
370370
}
@@ -394,7 +394,7 @@ impl FailureResult {
394394
}
395395

396396
/// Failure result is a validation error.
397-
#[allow(dead_code)] // Not constructed on wasm
397+
#[allow(dead_code, reason = "Not constructed on wasm")]
398398
pub(super) fn validation_error() -> Self {
399399
Self {
400400
kind: FailureResultKind::ValidationError,

tests/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//! Test utilities for the wgpu repository.
22
3-
#![allow(clippy::arc_with_non_send_sync)] // False positive on wasm
3+
#![allow(clippy::arc_with_non_send_sync, reason = "False positive on wasm")]
44

55
mod config;
66
mod expectations;

tests/tests/wgpu-gpu/create_surface_error.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@ fn canvas_get_context_returned_null() {
1616
// Using a context id that is not "webgl2" or "webgpu" will render the canvas unusable by wgpu.
1717
canvas.get_context("2d").unwrap();
1818

19-
#[allow(clippy::redundant_clone)] // false positive — can't and shouldn't move out.
19+
#[allow(
20+
clippy::redundant_clone,
21+
reason = "false positive — can't and shouldn't move out."
22+
)]
2023
let error = instance
2124
.create_surface(wgpu::SurfaceTarget::Canvas(canvas.clone()))
2225
.unwrap_err();

wgpu-core/src/resource.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2353,9 +2353,7 @@ impl Blas {
23532353
match map_res {
23542354
Ok(mapping) => {
23552355
if !mapping.is_coherent {
2356-
// Clippy complains about this because it might not be intended, but
2357-
// this is intentional.
2358-
#[expect(clippy::single_range_in_vec_init)]
2356+
#[expect(clippy::single_range_in_vec_init, reason = "intentional")]
23592357
self.device.raw().invalidate_mapped_ranges(
23602358
compaction_buffer,
23612359
&[0..size_of::<wgpu_types::BufferAddress>() as wgt::BufferAddress],

wgpu-hal/src/auxil/dxgi/time.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![allow(dead_code)] // IPresentationManager is unused currently
1+
#![allow(dead_code, reason = "IPresentationManager is unused currently")]
22

33
use windows::Win32::System::Performance::{QueryPerformanceCounter, QueryPerformanceFrequency};
44

0 commit comments

Comments
 (0)