Skip to content

Commit

Permalink
Clippy fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
oisyn committed Apr 12, 2023
1 parent bcc0939 commit 2758791
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 19 deletions.
2 changes: 1 addition & 1 deletion crates/spirv-std/macros/src/image.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ impl Parse for ImageType {
let value = value.unwrap();
set_unique!(
components = match value.base10_parse() {
Ok(n) if n >= 1 && n <= 4 => n,
Ok(n) if (1..=4).contains(&n) => n,
_ =>
return Err(syn::Error::new(
value.span(),
Expand Down
9 changes: 3 additions & 6 deletions crates/spirv-std/src/image.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
//! Image types

#[cfg(target_arch = "spirv")]
use crate::vector::VectorTruncateInto;
#[cfg(target_arch = "spirv")]
use core::arch::asm;

Expand All @@ -14,12 +16,7 @@ pub use spirv_std_types::image_params::{
AccessQualifier, Arrayed, Dimensionality, ImageDepth, ImageFormat, Multisampled, Sampled,
};

use crate::{
float::Float,
integer::Integer,
vector::{Vector, VectorTruncateInto},
Sampler,
};
use crate::{float::Float, integer::Integer, vector::Vector, Sampler};

/// Re-export of primitive types to ensure the `Image` proc macro always points
/// to the right type.
Expand Down
8 changes: 4 additions & 4 deletions tests/ui/image/gather_err.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ error[E0277]: the trait bound `Image<f32, 0, 2, 0, 0, 1, 0, 4>: HasGather` is no
Image<SampledType, 3, DEPTH, ARRAYED, 0, SAMPLED, FORMAT, COMPONENTS>
Image<SampledType, 4, DEPTH, ARRAYED, 0, SAMPLED, FORMAT, COMPONENTS>
note: required by a bound in `Image::<SampledType, DIM, DEPTH, ARRAYED, spirv_std::::image::{impl#1}::{constant#0}, SAMPLED, FORMAT, COMPONENTS>::gather`
--> $SPIRV_STD_SRC/image.rs:198:15
--> $SPIRV_STD_SRC/image.rs:195:15
|
198 | Self: HasGather,
195 | Self: HasGather,
| ^^^^^^^^^ required by this bound in `Image::<SampledType, DIM, DEPTH, ARRAYED, spirv_std::::image::{impl#1}::{constant#0}, SAMPLED, FORMAT, COMPONENTS>::gather`

error[E0277]: the trait bound `Image<f32, 2, 2, 0, 0, 1, 0, 4>: HasGather` is not satisfied
Expand All @@ -25,9 +25,9 @@ error[E0277]: the trait bound `Image<f32, 2, 2, 0, 0, 1, 0, 4>: HasGather` is no
Image<SampledType, 3, DEPTH, ARRAYED, 0, SAMPLED, FORMAT, COMPONENTS>
Image<SampledType, 4, DEPTH, ARRAYED, 0, SAMPLED, FORMAT, COMPONENTS>
note: required by a bound in `Image::<SampledType, DIM, DEPTH, ARRAYED, spirv_std::::image::{impl#1}::{constant#0}, SAMPLED, FORMAT, COMPONENTS>::gather`
--> $SPIRV_STD_SRC/image.rs:198:15
--> $SPIRV_STD_SRC/image.rs:195:15
|
198 | Self: HasGather,
195 | Self: HasGather,
| ^^^^^^^^^ required by this bound in `Image::<SampledType, DIM, DEPTH, ARRAYED, spirv_std::::image::{impl#1}::{constant#0}, SAMPLED, FORMAT, COMPONENTS>::gather`

error: aborting due to 2 previous errors
Expand Down
4 changes: 2 additions & 2 deletions tests/ui/image/query/query_levels_err.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ error[E0277]: the trait bound `Image<f32, 4, 2, 0, 0, 1, 0, 4>: HasQueryLevels`
Image<SampledType, 2, DEPTH, ARRAYED, MULTISAMPLED, SAMPLED, FORMAT, COMPONENTS>
Image<SampledType, 3, DEPTH, ARRAYED, MULTISAMPLED, SAMPLED, FORMAT, COMPONENTS>
note: required by a bound in `Image::<SampledType, DIM, DEPTH, ARRAYED, MULTISAMPLED, SAMPLED, FORMAT, COMPONENTS>::query_levels`
--> $SPIRV_STD_SRC/image.rs:882:15
--> $SPIRV_STD_SRC/image.rs:879:15
|
882 | Self: HasQueryLevels,
879 | Self: HasQueryLevels,
| ^^^^^^^^^^^^^^ required by this bound in `Image::<SampledType, DIM, DEPTH, ARRAYED, MULTISAMPLED, SAMPLED, FORMAT, COMPONENTS>::query_levels`

error: aborting due to previous error
Expand Down
4 changes: 2 additions & 2 deletions tests/ui/image/query/query_lod_err.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ error[E0277]: the trait bound `Image<f32, 4, 2, 0, 0, 1, 0, 4>: HasQueryLevels`
Image<SampledType, 2, DEPTH, ARRAYED, MULTISAMPLED, SAMPLED, FORMAT, COMPONENTS>
Image<SampledType, 3, DEPTH, ARRAYED, MULTISAMPLED, SAMPLED, FORMAT, COMPONENTS>
note: required by a bound in `Image::<SampledType, DIM, DEPTH, ARRAYED, MULTISAMPLED, SAMPLED, FORMAT, COMPONENTS>::query_lod`
--> $SPIRV_STD_SRC/image.rs:908:15
--> $SPIRV_STD_SRC/image.rs:905:15
|
908 | Self: HasQueryLevels,
905 | Self: HasQueryLevels,
| ^^^^^^^^^^^^^^ required by this bound in `Image::<SampledType, DIM, DEPTH, ARRAYED, MULTISAMPLED, SAMPLED, FORMAT, COMPONENTS>::query_lod`

error: aborting due to previous error
Expand Down
4 changes: 2 additions & 2 deletions tests/ui/image/query/query_size_err.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ error[E0277]: the trait bound `Image<f32, 1, 2, 0, 0, 1, 0, 4>: HasQuerySize` is
Image<SampledType, 2, DEPTH, ARRAYED, 0, 2, FORMAT, COMPONENTS>
and 6 others
note: required by a bound in `Image::<SampledType, DIM, DEPTH, ARRAYED, MULTISAMPLED, SAMPLED, FORMAT, COMPONENTS>::query_size`
--> $SPIRV_STD_SRC/image.rs:939:15
--> $SPIRV_STD_SRC/image.rs:936:15
|
939 | Self: HasQuerySize,
936 | Self: HasQuerySize,
| ^^^^^^^^^^^^ required by this bound in `Image::<SampledType, DIM, DEPTH, ARRAYED, MULTISAMPLED, SAMPLED, FORMAT, COMPONENTS>::query_size`

error: aborting due to previous error
Expand Down
4 changes: 2 additions & 2 deletions tests/ui/image/query/query_size_lod_err.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ error[E0277]: the trait bound `Image<f32, 4, 2, 0, 0, 1, 0, 4>: HasQuerySizeLod`
Image<SampledType, 2, DEPTH, ARRAYED, 0, SAMPLED, FORMAT, COMPONENTS>
Image<SampledType, 3, DEPTH, ARRAYED, 0, SAMPLED, FORMAT, COMPONENTS>
note: required by a bound in `Image::<SampledType, DIM, DEPTH, ARRAYED, spirv_std::::image::{impl#7}::{constant#0}, SAMPLED, FORMAT, COMPONENTS>::query_size_lod`
--> $SPIRV_STD_SRC/image.rs:983:15
--> $SPIRV_STD_SRC/image.rs:980:15
|
983 | Self: HasQuerySizeLod,
980 | Self: HasQuerySizeLod,
| ^^^^^^^^^^^^^^^ required by this bound in `Image::<SampledType, DIM, DEPTH, ARRAYED, spirv_std::::image::{impl#7}::{constant#0}, SAMPLED, FORMAT, COMPONENTS>::query_size_lod`

error: aborting due to previous error
Expand Down

0 comments on commit 2758791

Please sign in to comment.