Skip to content

Commit e724538

Browse files
committed
Fix New Clippy Lints From Rust 1.54.0
Fixes a number of new lints introduce in the updated clippy that CI is now using.
1 parent 7c4ab4e commit e724538

File tree

8 files changed

+85
-91
lines changed

8 files changed

+85
-91
lines changed

wgpu-core/src/device/mod.rs

+20-24
Original file line numberDiff line numberDiff line change
@@ -1000,7 +1000,7 @@ impl<A: HalApi> Device<A> {
10001000
) -> Option<id::BindGroupLayoutId> {
10011001
guard
10021002
.iter(self_id.backend())
1003-
.find(|&(_, ref bgl)| bgl.device_id.value.0 == self_id && bgl.entries == *entry_map)
1003+
.find(|&(_, bgl)| bgl.device_id.value.0 == self_id && bgl.entries == *entry_map)
10041004
.map(|(id, value)| {
10051005
value.multi_ref_count.inc();
10061006
id
@@ -1322,9 +1322,9 @@ impl<A: HalApi> Device<A> {
13221322
let res_index = match entry.resource {
13231323
Br::Buffer(ref bb) => {
13241324
let bb = Self::create_buffer_binding(
1325-
&bb,
1325+
bb,
13261326
binding,
1327-
&decl,
1327+
decl,
13281328
&mut used_buffer_ranges,
13291329
&mut dynamic_binding_info,
13301330
&mut used,
@@ -1355,7 +1355,7 @@ impl<A: HalApi> Device<A> {
13551355
let bb = Self::create_buffer_binding(
13561356
bb,
13571357
binding,
1358-
&decl,
1358+
decl,
13591359
&mut used_buffer_ranges,
13601360
&mut dynamic_binding_info,
13611361
&mut used,
@@ -2225,7 +2225,7 @@ impl<A: HalApi> Device<A> {
22252225
if validated_stages.contains(wgt::ShaderStages::FRAGMENT) {
22262226
for (i, state) in color_targets.iter().enumerate() {
22272227
match io.get(&(i as wgt::ShaderLocation)) {
2228-
Some(ref output) => {
2228+
Some(output) => {
22292229
validation::check_texture_format(state.format, &output.ty).map_err(
22302230
|pipeline| {
22312231
pipeline::CreateRenderPipelineError::ColorState(
@@ -3546,16 +3546,12 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
35463546
Ok(layout) => layout,
35473547
Err(_) => break binding_model::CreateBindGroupError::InvalidLayout,
35483548
};
3549-
let bind_group = match device.create_bind_group(
3550-
device_id,
3551-
bind_group_layout,
3552-
desc,
3553-
&hub,
3554-
&mut token,
3555-
) {
3556-
Ok(bind_group) => bind_group,
3557-
Err(e) => break e,
3558-
};
3549+
let bind_group =
3550+
match device.create_bind_group(device_id, bind_group_layout, desc, hub, &mut token)
3551+
{
3552+
Ok(bind_group) => bind_group,
3553+
Err(e) => break e,
3554+
};
35593555
let ref_count = bind_group.life_guard.add_ref();
35603556

35613557
let id = fid.assign(bind_group, &mut token);
@@ -3808,7 +3804,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
38083804
.unregister(command_encoder_id, &mut token);
38093805
if let Some(cmdbuf) = cmdbuf {
38103806
let device = &mut device_guard[cmdbuf.device_id.value];
3811-
device.untrack::<G>(&hub, &cmdbuf.trackers, &mut token);
3807+
device.untrack::<G>(hub, &cmdbuf.trackers, &mut token);
38123808
}
38133809
}
38143810

@@ -3864,7 +3860,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
38643860
});
38653861
}
38663862

3867-
let render_bundle = match bundle_encoder.finish(desc, device, &hub, &mut token) {
3863+
let render_bundle = match bundle_encoder.finish(desc, device, hub, &mut token) {
38683864
Ok(bundle) => bundle,
38693865
Err(e) => break e,
38703866
};
@@ -4012,7 +4008,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
40124008
let mut token = Token::root();
40134009

40144010
let fid = hub.render_pipelines.prepare(id_in);
4015-
let implicit_context = implicit_pipeline_ids.map(|ipi| ipi.prepare(&hub));
4011+
let implicit_context = implicit_pipeline_ids.map(|ipi| ipi.prepare(hub));
40164012

40174013
let (adapter_guard, mut token) = hub.adapters.read(&mut token);
40184014
let (device_guard, mut token) = hub.devices.read(&mut token);
@@ -4036,7 +4032,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
40364032
adapter,
40374033
desc,
40384034
implicit_context,
4039-
&hub,
4035+
hub,
40404036
&mut token,
40414037
) {
40424038
Ok(pair) => pair,
@@ -4146,7 +4142,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
41464142
let mut token = Token::root();
41474143

41484144
let fid = hub.compute_pipelines.prepare(id_in);
4149-
let implicit_context = implicit_pipeline_ids.map(|ipi| ipi.prepare(&hub));
4145+
let implicit_context = implicit_pipeline_ids.map(|ipi| ipi.prepare(hub));
41504146

41514147
let (device_guard, mut token) = hub.devices.read(&mut token);
41524148
let error = loop {
@@ -4167,7 +4163,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
41674163
device_id,
41684164
desc,
41694165
implicit_context,
4170-
&hub,
4166+
hub,
41714167
&mut token,
41724168
) {
41734169
Ok(pair) => pair,
@@ -4423,7 +4419,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
44234419
let (device_guard, mut token) = hub.devices.read(&mut token);
44244420
let device = device_guard.get(device_id).map_err(|_| InvalidDevice)?;
44254421
device.lock_life(&mut token).triage_suspected(
4426-
&hub,
4422+
hub,
44274423
&device.trackers,
44284424
#[cfg(feature = "trace")]
44294425
None,
@@ -4444,7 +4440,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
44444440
device_guard
44454441
.get(device_id)
44464442
.map_err(|_| DeviceError::Invalid)?
4447-
.maintain(&hub, force_wait, &mut token)?
4443+
.maintain(hub, force_wait, &mut token)?
44484444
};
44494445
fire_map_callbacks(callbacks);
44504446
Ok(())
@@ -4461,7 +4457,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
44614457
let mut token = Token::root();
44624458
let (device_guard, mut token) = hub.devices.read(&mut token);
44634459
for (_, device) in device_guard.iter(A::VARIANT) {
4464-
let cbs = device.maintain(&hub, force_wait, &mut token)?;
4460+
let cbs = device.maintain(hub, force_wait, &mut token)?;
44654461
callbacks.extend(cbs);
44664462
}
44674463
Ok(())

wgpu-core/src/device/queue.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -741,7 +741,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
741741

742742
// This will schedule destruction of all resources that are no longer needed
743743
// by the user but used in the command stream, among other things.
744-
let callbacks = match device.maintain(&hub, false, &mut token) {
744+
let callbacks = match device.maintain(hub, false, &mut token) {
745745
Ok(callbacks) => callbacks,
746746
Err(WaitIdleError::Device(err)) => return Err(QueueSubmitError::Queue(err)),
747747
Err(WaitIdleError::StuckGpu) => return Err(QueueSubmitError::StuckGpu),

wgpu-core/src/instance.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -677,7 +677,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
677677
profiling::scope!("create_adapter_from_hal", "Instance");
678678

679679
let mut token = Token::root();
680-
let fid = A::hub(&self).adapters.prepare(input);
680+
let fid = A::hub(self).adapters.prepare(input);
681681

682682
match A::VARIANT {
683683
#[cfg(vulkan)]

wgpu-hal/src/metal/adapter.rs

+44-44
Original file line numberDiff line numberDiff line change
@@ -585,134 +585,134 @@ impl super::PrivateCapabilities {
585585
} else {
586586
mtl::MTLReadWriteTextureTier::TierNone
587587
},
588-
resource_heaps: Self::supports_any(&device, RESOURCE_HEAP_SUPPORT),
589-
argument_buffers: Self::supports_any(&device, ARGUMENT_BUFFER_SUPPORT),
588+
resource_heaps: Self::supports_any(device, RESOURCE_HEAP_SUPPORT),
589+
argument_buffers: Self::supports_any(device, ARGUMENT_BUFFER_SUPPORT),
590590
shared_textures: !os_is_mac,
591591
mutable_comparison_samplers: Self::supports_any(
592-
&device,
592+
device,
593593
MUTABLE_COMPARISON_SAMPLER_SUPPORT,
594594
),
595-
sampler_clamp_to_border: Self::supports_any(&device, SAMPLER_CLAMP_TO_BORDER_SUPPORT),
595+
sampler_clamp_to_border: Self::supports_any(device, SAMPLER_CLAMP_TO_BORDER_SUPPORT),
596596
sampler_lod_average: {
597597
// TODO: Clarify minimum macOS version with Apple (43707452)
598598
let need_version = if os_is_mac { (10, 13) } else { (9, 0) };
599599
Self::version_at_least(major, minor, need_version.0, need_version.1)
600600
},
601-
base_instance: Self::supports_any(&device, BASE_INSTANCE_SUPPORT),
602-
base_vertex_instance_drawing: Self::supports_any(&device, BASE_VERTEX_INSTANCE_SUPPORT),
603-
dual_source_blending: Self::supports_any(&device, DUAL_SOURCE_BLEND_SUPPORT),
601+
base_instance: Self::supports_any(device, BASE_INSTANCE_SUPPORT),
602+
base_vertex_instance_drawing: Self::supports_any(device, BASE_VERTEX_INSTANCE_SUPPORT),
603+
dual_source_blending: Self::supports_any(device, DUAL_SOURCE_BLEND_SUPPORT),
604604
low_power: !os_is_mac || device.is_low_power(),
605605
headless: os_is_mac && device.is_headless(),
606-
layered_rendering: Self::supports_any(&device, LAYERED_RENDERING_SUPPORT),
607-
function_specialization: Self::supports_any(&device, FUNCTION_SPECIALIZATION_SUPPORT),
608-
depth_clip_mode: Self::supports_any(&device, DEPTH_CLIP_MODE),
609-
texture_cube_array: Self::supports_any(&device, TEXTURE_CUBE_ARRAY_SUPPORT),
606+
layered_rendering: Self::supports_any(device, LAYERED_RENDERING_SUPPORT),
607+
function_specialization: Self::supports_any(device, FUNCTION_SPECIALIZATION_SUPPORT),
608+
depth_clip_mode: Self::supports_any(device, DEPTH_CLIP_MODE),
609+
texture_cube_array: Self::supports_any(device, TEXTURE_CUBE_ARRAY_SUPPORT),
610610
format_depth24_stencil8: os_is_mac && device.d24_s8_supported(),
611611
format_depth32_stencil8_filter: os_is_mac,
612612
format_depth32_stencil8_none: !os_is_mac,
613613
format_min_srgb_channels: if os_is_mac { 4 } else { 1 },
614614
format_b5: !os_is_mac,
615615
format_bc: os_is_mac,
616616
format_eac_etc: !os_is_mac,
617-
format_astc: Self::supports_any(&device, ASTC_PIXEL_FORMAT_FEATURES),
618-
format_any8_unorm_srgb_all: Self::supports_any(&device, ANY8_UNORM_SRGB_ALL),
619-
format_any8_unorm_srgb_no_write: !Self::supports_any(&device, ANY8_UNORM_SRGB_ALL)
617+
format_astc: Self::supports_any(device, ASTC_PIXEL_FORMAT_FEATURES),
618+
format_any8_unorm_srgb_all: Self::supports_any(device, ANY8_UNORM_SRGB_ALL),
619+
format_any8_unorm_srgb_no_write: !Self::supports_any(device, ANY8_UNORM_SRGB_ALL)
620620
&& !os_is_mac,
621-
format_any8_snorm_all: Self::supports_any(&device, ANY8_SNORM_RESOLVE),
621+
format_any8_snorm_all: Self::supports_any(device, ANY8_SNORM_RESOLVE),
622622
format_r16_norm_all: os_is_mac,
623623
format_r32_all: !Self::supports_any(
624-
&device,
624+
device,
625625
&[
626626
MTLFeatureSet::iOS_GPUFamily1_v1,
627627
MTLFeatureSet::iOS_GPUFamily2_v1,
628628
],
629629
),
630630
format_r32_no_write: Self::supports_any(
631-
&device,
631+
device,
632632
&[
633633
MTLFeatureSet::iOS_GPUFamily1_v1,
634634
MTLFeatureSet::iOS_GPUFamily2_v1,
635635
],
636636
),
637637
format_r32float_no_write_no_filter: Self::supports_any(
638-
&device,
638+
device,
639639
&[
640640
MTLFeatureSet::iOS_GPUFamily1_v1,
641641
MTLFeatureSet::iOS_GPUFamily2_v1,
642642
],
643643
) && !os_is_mac,
644644
format_r32float_no_filter: !Self::supports_any(
645-
&device,
645+
device,
646646
&[
647647
MTLFeatureSet::iOS_GPUFamily1_v1,
648648
MTLFeatureSet::iOS_GPUFamily2_v1,
649649
],
650650
) && !os_is_mac,
651651
format_r32float_all: os_is_mac,
652-
format_rgba8_srgb_all: Self::supports_any(&device, RGBA8_SRGB),
653-
format_rgba8_srgb_no_write: !Self::supports_any(&device, RGBA8_SRGB),
654-
format_rgb10a2_unorm_all: Self::supports_any(&device, RGB10A2UNORM_ALL),
655-
format_rgb10a2_unorm_no_write: !Self::supports_any(&device, RGB10A2UNORM_ALL),
656-
format_rgb10a2_uint_color: !Self::supports_any(&device, RGB10A2UINT_COLOR_WRITE),
657-
format_rgb10a2_uint_color_write: Self::supports_any(&device, RGB10A2UINT_COLOR_WRITE),
658-
format_rg11b10_all: Self::supports_any(&device, RG11B10FLOAT_ALL),
659-
format_rg11b10_no_write: !Self::supports_any(&device, RG11B10FLOAT_ALL),
660-
format_rgb9e5_all: Self::supports_any(&device, RGB9E5FLOAT_ALL),
661-
format_rgb9e5_no_write: !Self::supports_any(&device, RGB9E5FLOAT_ALL) && !os_is_mac,
652+
format_rgba8_srgb_all: Self::supports_any(device, RGBA8_SRGB),
653+
format_rgba8_srgb_no_write: !Self::supports_any(device, RGBA8_SRGB),
654+
format_rgb10a2_unorm_all: Self::supports_any(device, RGB10A2UNORM_ALL),
655+
format_rgb10a2_unorm_no_write: !Self::supports_any(device, RGB10A2UNORM_ALL),
656+
format_rgb10a2_uint_color: !Self::supports_any(device, RGB10A2UINT_COLOR_WRITE),
657+
format_rgb10a2_uint_color_write: Self::supports_any(device, RGB10A2UINT_COLOR_WRITE),
658+
format_rg11b10_all: Self::supports_any(device, RG11B10FLOAT_ALL),
659+
format_rg11b10_no_write: !Self::supports_any(device, RG11B10FLOAT_ALL),
660+
format_rgb9e5_all: Self::supports_any(device, RGB9E5FLOAT_ALL),
661+
format_rgb9e5_no_write: !Self::supports_any(device, RGB9E5FLOAT_ALL) && !os_is_mac,
662662
format_rgb9e5_filter_only: os_is_mac,
663663
format_rg32_color: Self::supports_any(
664-
&device,
664+
device,
665665
&[
666666
MTLFeatureSet::iOS_GPUFamily1_v1,
667667
MTLFeatureSet::iOS_GPUFamily2_v1,
668668
],
669669
),
670670
format_rg32_color_write: !Self::supports_any(
671-
&device,
671+
device,
672672
&[
673673
MTLFeatureSet::iOS_GPUFamily1_v1,
674674
MTLFeatureSet::iOS_GPUFamily2_v1,
675675
],
676676
),
677677
format_rg32float_all: os_is_mac,
678678
format_rg32float_color_blend: Self::supports_any(
679-
&device,
679+
device,
680680
&[
681681
MTLFeatureSet::iOS_GPUFamily1_v1,
682682
MTLFeatureSet::iOS_GPUFamily2_v1,
683683
],
684684
),
685685
format_rg32float_no_filter: !os_is_mac
686686
&& !Self::supports_any(
687-
&device,
687+
device,
688688
&[
689689
MTLFeatureSet::iOS_GPUFamily1_v1,
690690
MTLFeatureSet::iOS_GPUFamily2_v1,
691691
],
692692
),
693693
format_rgba32int_color: Self::supports_any(
694-
&device,
694+
device,
695695
&[
696696
MTLFeatureSet::iOS_GPUFamily1_v1,
697697
MTLFeatureSet::iOS_GPUFamily2_v1,
698698
],
699699
),
700700
format_rgba32int_color_write: !Self::supports_any(
701-
&device,
701+
device,
702702
&[
703703
MTLFeatureSet::iOS_GPUFamily1_v1,
704704
MTLFeatureSet::iOS_GPUFamily2_v1,
705705
],
706706
),
707707
format_rgba32float_color: Self::supports_any(
708-
&device,
708+
device,
709709
&[
710710
MTLFeatureSet::iOS_GPUFamily1_v1,
711711
MTLFeatureSet::iOS_GPUFamily2_v1,
712712
],
713713
),
714714
format_rgba32float_color_write: !Self::supports_any(
715-
&device,
715+
device,
716716
&[
717717
MTLFeatureSet::iOS_GPUFamily1_v1,
718718
MTLFeatureSet::iOS_GPUFamily2_v1,
@@ -724,7 +724,7 @@ impl super::PrivateCapabilities {
724724
.supports_feature_set(MTLFeatureSet::macOS_GPUFamily1_v1),
725725
format_depth32float_none: !device
726726
.supports_feature_set(MTLFeatureSet::macOS_GPUFamily1_v1),
727-
format_bgr10a2_all: Self::supports_any(&device, BGR10A2_ALL),
727+
format_bgr10a2_all: Self::supports_any(device, BGR10A2_ALL),
728728
format_bgr10a2_no_write: !device
729729
.supports_feature_set(MTLFeatureSet::macOS_GPUFamily1_v3),
730730
max_buffers_per_stage: 31,
@@ -737,7 +737,7 @@ impl super::PrivateCapabilities {
737737
1 << 28 // 256MB otherwise
738738
},
739739
max_texture_size: if Self::supports_any(
740-
&device,
740+
device,
741741
&[
742742
MTLFeatureSet::iOS_GPUFamily3_v1,
743743
MTLFeatureSet::tvOS_GPUFamily2_v1,
@@ -746,7 +746,7 @@ impl super::PrivateCapabilities {
746746
) {
747747
16384
748748
} else if Self::supports_any(
749-
&device,
749+
device,
750750
&[
751751
MTLFeatureSet::iOS_GPUFamily1_v2,
752752
MTLFeatureSet::iOS_GPUFamily2_v2,
@@ -761,7 +761,7 @@ impl super::PrivateCapabilities {
761761
max_texture_layers: 2048,
762762
max_fragment_input_components: if os_is_mac { 128 } else { 60 },
763763
max_color_render_targets: if Self::supports_any(
764-
&device,
764+
device,
765765
&[
766766
MTLFeatureSet::iOS_GPUFamily2_v1,
767767
MTLFeatureSet::iOS_GPUFamily3_v1,
@@ -778,15 +778,15 @@ impl super::PrivateCapabilities {
778778
4
779779
},
780780
max_total_threadgroup_memory: if Self::supports_any(
781-
&device,
781+
device,
782782
&[
783783
MTLFeatureSet::iOS_GPUFamily4_v2,
784784
MTLFeatureSet::iOS_GPUFamily5_v1,
785785
],
786786
) {
787787
64 << 10
788788
} else if Self::supports_any(
789-
&device,
789+
device,
790790
&[
791791
MTLFeatureSet::iOS_GPUFamily4_v1,
792792
MTLFeatureSet::macOS_GPUFamily1_v2,
@@ -799,7 +799,7 @@ impl super::PrivateCapabilities {
799799
},
800800
sample_count_mask,
801801
supports_debug_markers: Self::supports_any(
802-
&device,
802+
device,
803803
&[
804804
MTLFeatureSet::macOS_GPUFamily1_v2,
805805
MTLFeatureSet::macOS_GPUFamily2_v1,

0 commit comments

Comments
 (0)