fix 1.65 clippy lints (#2112)

This commit is contained in:
Teodor Tanasoaia
2022-11-03 18:32:20 +01:00
committed by GitHub
parent 21c7092762
commit 01fbdea21f
4 changed files with 8 additions and 10 deletions

View File

@@ -73,7 +73,6 @@ impl crate::TypeInner {
/// Used to generate the name of the wrapped type constructor
pub(super) fn hlsl_type_id<'a>(
&self,
base: crate::Handle<crate::Type>,
types: &crate::UniqueArena<crate::Type>,
constants: &crate::Arena<crate::Constant>,
@@ -103,7 +102,7 @@ impl crate::TypeInner {
} => Cow::Owned(format!(
"array{}_{}_",
constants[size].to_array_length().unwrap(),
self.hlsl_type_id(base, types, constants, names)?
Self::hlsl_type_id(base, types, constants, names)?
)),
crate::TypeInner::Struct { .. } => {
Cow::Borrowed(&names[&crate::proc::NameKey::Type(base)])

View File

@@ -274,7 +274,7 @@ impl<'a, W: Write> super::Writer<'a, W> {
// Write function body
writeln!(self.out, "{{")?;
let array_coords = if wiq.arrayed { 1 } else { 0 };
let array_coords = usize::from(wiq.arrayed);
// extra parameter is the mip level count or the sample count
let extra_coords = match wiq.class {
crate::ImageClass::Storage { .. } => 0,
@@ -358,7 +358,7 @@ impl<'a, W: Write> super::Writer<'a, W> {
module: &crate::Module,
constructor: WrappedConstructor,
) -> BackendResult {
let name = module.types[constructor.ty].inner.hlsl_type_id(
let name = crate::TypeInner::hlsl_type_id(
constructor.ty,
&module.types,
&module.constants,
@@ -927,7 +927,7 @@ impl<'a, W: Write> super::Writer<'a, W> {
if let Some(crate::AddressSpace::Storage { .. }) = pointer_space {
if let Some(ty) = func_ctx.info[handle].ty.handle() {
write_wrapped_constructor(self, ty, module, func_ctx)?;
write_wrapped_constructor(self, ty, module)?;
}
}
@@ -935,12 +935,11 @@ impl<'a, W: Write> super::Writer<'a, W> {
writer: &mut super::Writer<'_, W>,
ty: Handle<crate::Type>,
module: &crate::Module,
func_ctx: &FunctionCtx,
) -> BackendResult {
match module.types[ty].inner {
crate::TypeInner::Struct { ref members, .. } => {
for member in members {
write_wrapped_constructor(writer, member.ty, module, func_ctx)?;
write_wrapped_constructor(writer, member.ty, module)?;
}
let constructor = WrappedConstructor { ty };
@@ -951,7 +950,7 @@ impl<'a, W: Write> super::Writer<'a, W> {
}
}
crate::TypeInner::Array { base, .. } => {
write_wrapped_constructor(writer, base, module, func_ctx)?;
write_wrapped_constructor(writer, base, module)?;
}
_ => {}
};

View File

@@ -1017,7 +1017,7 @@ impl<'w> BlockContext<'w> {
Id::D3 => 3,
};
let extended_size_type_id = {
let array_coords = if arrayed { 1 } else { 0 };
let array_coords = usize::from(arrayed);
let vector_size = match dim_coords + array_coords {
2 => Some(crate::VectorSize::Bi),
3 => Some(crate::VectorSize::Tri),

View File

@@ -105,7 +105,7 @@ impl ShaderMetadata {
self.version = 0;
self.profile = Profile::Core;
self.stage = stage;
self.workgroup_size = [if stage == ShaderStage::Compute { 1 } else { 0 }; 3];
self.workgroup_size = [u32::from(stage == ShaderStage::Compute); 3];
self.early_fragment_tests = false;
self.extensions.clear();
}