diff --git a/wgpu-core/src/conv.rs b/wgpu-core/src/conv.rs index a3596cf43..510ec6c56 100644 --- a/wgpu-core/src/conv.rs +++ b/wgpu-core/src/conv.rs @@ -434,7 +434,7 @@ fn checked_u32_as_u16(value: u32) -> u16 { value as u16 } -fn is_power_or_two(val: u32) -> bool { +fn is_power_of_two(val: u32) -> bool { val != 0 && (val & (val - 1)) == 0 } @@ -457,7 +457,7 @@ pub fn map_texture_dimension_size( } D2 => { assert!( - sample_size <= 32 && is_power_or_two(sample_size), + sample_size <= 32 && is_power_of_two(sample_size), "Invalid sample_count of {}", sample_size ); diff --git a/wgpu-core/src/device/mod.rs b/wgpu-core/src/device/mod.rs index 60a965fd3..7a10bd30b 100644 --- a/wgpu-core/src/device/mod.rs +++ b/wgpu-core/src/device/mod.rs @@ -1105,7 +1105,7 @@ impl Global { | binding_model::BindingType::SampledTexture | binding_model::BindingType::ReadonlyStorageTexture | binding_model::BindingType::WriteonlyStorageTexture => { - panic!("Mismatched buffer binding type for {:?}. Expected a type of UniformBuffer, StorageBuffer or ReadonlyStorageBuffer but found {:?}", decl, decl.ty) + panic!("Mismatched buffer binding type for {:?}. Expected a type of UniformBuffer, StorageBuffer or ReadonlyStorageBuffer", decl) } }; assert_eq!( @@ -1145,7 +1145,7 @@ impl Global { match decl.ty { binding_model::BindingType::Sampler | binding_model::BindingType::ComparisonSampler => {} - found => panic!("Mismatched sampler binding type in {:?}. Expected a type of Sampler or ComparisonSampler but found {:?}", decl.ty, found), + _ => panic!("Mismatched sampler binding type in {:?}. Expected a type of Sampler or ComparisonSampler", decl.ty), } let sampler = used .samplers @@ -1170,7 +1170,7 @@ impl Global { resource::TextureUse::STORAGE_STORE, hal::image::Layout::General, ), - found => panic!("Mismatched texture binding type in {:?}. Expected a type of SampledTexture, ReadonlyStorageTexture or WriteonlyStorageTexture but found {:?}", decl, found), + _ => panic!("Mismatched texture binding type in {:?}. Expected a type of SampledTexture, ReadonlyStorageTexture or WriteonlyStorageTexture", decl), }; let view = used .views