Skip to content

Commit e33c06c

Browse files
committed
Fix clippy
1 parent 59ecc2e commit e33c06c

File tree

4 files changed

+13
-14
lines changed

4 files changed

+13
-14
lines changed

wgpu/src/api/shader_module.rs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
use alloc::{
2-
borrow::Cow,
32
string::{String, ToString as _},
43
vec,
54
vec::Vec,
@@ -11,9 +10,9 @@ use crate::*;
1110
/// Handle to a compiled shader module.
1211
///
1312
/// A `ShaderModule` represents a compiled shader module on the GPU. It can be created by passing
14-
/// source code to [`Device::create_shader_module`] or valid SPIR-V binary to
15-
/// [`Device::create_shader_module_spirv`]. Shader modules are used to define programmable stages
16-
/// of a pipeline.
13+
/// source code to [`Device::create_shader_module`]. MSL shader or SPIR-V binary can also be passed
14+
/// directly using [`Device::create_shader_module_passthrough`]. Shader modules are used to define
15+
/// programmable stages of a pipeline.
1716
///
1817
/// Corresponds to [WebGPU `GPUShaderModule`](https://gpuweb.github.io/gpuweb/#shader-module).
1918
#[derive(Debug, Clone)]
@@ -182,14 +181,14 @@ pub enum ShaderSource<'a> {
182181
///
183182
/// See also: [`util::make_spirv`], [`include_spirv`]
184183
#[cfg(feature = "spirv")]
185-
SpirV(Cow<'a, [u32]>),
184+
SpirV(alloc::borrow::Cow<'a, [u32]>),
186185
/// GLSL module as a string slice.
187186
///
188187
/// Note: GLSL is not yet fully supported and must be a specific ShaderStage.
189188
#[cfg(feature = "glsl")]
190189
Glsl {
191190
/// The source code of the shader.
192-
shader: Cow<'a, str>,
191+
shader: alloc::borrow::Cow<'a, str>,
193192
/// The shader stage that the shader targets. For example, `naga::ShaderStage::Vertex`
194193
stage: naga::ShaderStage,
195194
/// Key-value pairs to represent defines sent to the glsl preprocessor.
@@ -199,10 +198,10 @@ pub enum ShaderSource<'a> {
199198
},
200199
/// WGSL module as a string slice.
201200
#[cfg(feature = "wgsl")]
202-
Wgsl(Cow<'a, str>),
201+
Wgsl(alloc::borrow::Cow<'a, str>),
203202
/// Naga module.
204203
#[cfg(feature = "naga-ir")]
205-
Naga(Cow<'static, naga::Module>),
204+
Naga(alloc::borrow::Cow<'static, naga::Module>),
206205
/// Dummy variant because `Naga` doesn't have a lifetime and without enough active features it
207206
/// could be the last one active.
208207
#[doc(hidden)]

wgpu/src/backend/webgpu.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1845,8 +1845,8 @@ impl dispatch::DeviceInterface for WebDevice {
18451845

18461846
unsafe fn create_shader_module_passthrough(
18471847
&self,
1848-
desc: &crate::ShaderModuleDescriptorPassthrough<'_>,
1849-
) -> DispatchShaderModule {
1848+
_desc: &crate::ShaderModuleDescriptorPassthrough<'_>,
1849+
) -> dispatch::DispatchShaderModule {
18501850
unreachable!("No XXX_SHADER_PASSTHROUGH feature enabled for this backend")
18511851
}
18521852

wgpu/src/backend/wgpu_core.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use alloc::{
2-
borrow::Cow::Borrowed,
2+
borrow::Cow::{self, Borrowed},
33
boxed::Box,
44
format,
55
string::{String, ToString as _},
@@ -1047,7 +1047,7 @@ impl dispatch::DeviceInterface for CoreDevice {
10471047
&self,
10481048
desc: &crate::ShaderModuleDescriptorPassthrough<'_>,
10491049
) -> dispatch::DispatchShaderModule {
1050-
let desc = desc.map_label(|l| l.map(std::borrow::Cow::from));
1050+
let desc = desc.map_label(|l| l.map(Cow::from));
10511051
let (id, error) = unsafe {
10521052
self.context
10531053
.0

wgpu/src/util/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,10 @@ pub fn make_spirv(data: &[u8]) -> super::ShaderSource<'_> {
3939
super::ShaderSource::SpirV(make_spirv_raw(data))
4040
}
4141

42-
/// Version of `make_spirv` intended for use with [`Device::create_shader_module_spirv`].
42+
/// Version of `make_spirv` intended for use with [`Device::create_shader_module_passthrough`].
4343
/// Returns a raw slice instead of [`ShaderSource`](super::ShaderSource).
4444
///
45-
/// [`Device::create_shader_module_spirv`]: crate::Device::create_shader_module_spirv
45+
/// [`Device::create_shader_module_passthrough`]: crate::Device::create_shader_module_passthrough
4646
pub fn make_spirv_raw(data: &[u8]) -> Cow<'_, [u32]> {
4747
const MAGIC_NUMBER: u32 = 0x0723_0203;
4848
assert_eq!(

0 commit comments

Comments
 (0)