Skip to content

Commit

Permalink
Allow clippy::pattern_type_mismatch (#4887)
Browse files Browse the repository at this point in the history
  • Loading branch information
nical authored Dec 17, 2023
1 parent 2053358 commit 10dd584
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 10 deletions.
2 changes: 1 addition & 1 deletion wgpu-core/src/device/resource.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3073,7 +3073,7 @@ impl<A: HalApi> Device<A> {
if validated_stages.contains(wgt::ShaderStages::FRAGMENT) {
for (i, output) in io.iter() {
match color_targets.get(*i as usize) {
Some(&Some(ref state)) => {
Some(Some(state)) => {
validation::check_texture_format(state.format, &output.ty).map_err(
|pipeline| {
pipeline::CreateRenderPipelineError::ColorState(
Expand Down
8 changes: 3 additions & 5 deletions wgpu-core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,15 @@
// For some reason `rustc` can warn about these in const generics even
// though they are required.
unused_braces,
// Clashes with clippy::pattern_type_mismatch
clippy::needless_borrowed_reference,
// It gets in the way a lot and does not prevent bugs in practice.
clippy::pattern_type_mismatch,
)]
#![warn(
trivial_casts,
trivial_numeric_casts,
unsafe_op_in_unsafe_fn,
unused_extern_crates,
unused_qualifications,
// We don't match on a reference, unless required.
clippy::pattern_type_mismatch,
unused_qualifications
)]

pub mod any_surface;
Expand Down
2 changes: 1 addition & 1 deletion wgpu-core/src/storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ where
pub(crate) fn label_for_invalid_id(&self, id: I) -> &str {
let (index, _, _) = id.unzip();
match self.map.get(index as usize) {
Some(&Element::Error(_, ref label)) => label,
Some(Element::Error(_, label)) => label,
_ => "",
}
}
Expand Down
4 changes: 2 additions & 2 deletions wgpu-core/src/track/range.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ impl<I: Copy + Ord, T: Copy + PartialEq> RangedStates<I, T> {
) -> impl Iterator<Item = (Range<I>, &T)> + 'a {
self.ranges
.iter()
.filter(move |&&(ref inner, ..)| inner.end > range.start && inner.start < range.end)
.map(move |&(ref inner, ref v)| {
.filter(move |&(inner, ..)| inner.end > range.start && inner.start < range.end)
.map(move |(inner, v)| {
let new_range = inner.start.max(range.start)..inner.end.min(range.end);

(new_range, v)
Expand Down
2 changes: 1 addition & 1 deletion wgpu-core/src/track/stateless.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ impl<Id: TypedId, T: Resource<Id>> StatelessBindGroupSate<Id, T> {
let resources = self.resources.lock();
resources
.iter()
.map(|&(_, ref resource)| resource.clone())
.map(|(_, resource)| resource.clone())
.collect::<Vec<_>>()
.into_iter()
}
Expand Down

0 comments on commit 10dd584

Please sign in to comment.