Address/silence new clippy lints.

This commit is contained in:
Eduard-Mihai Burtescu 2023-07-25 23:40:10 +03:00 committed by Eduard-Mihai Burtescu
parent 50ebb52619
commit e87c324bfd
4 changed files with 40 additions and 28 deletions

View File

@ -619,9 +619,11 @@ impl<'tcx> BuilderSpirv<'tcx> {
Ok(())
}
SpirvConst::Composite(v) => v.iter().fold(Ok(()), |composite_legal, field| {
SpirvConst::Composite(v) => v
.iter()
.map(|field| {
let field_entry = &self.id_to_const.borrow()[field];
let field_legal_in_composite = field_entry.legal.and(
field_entry.legal.and(
// `field` is itself some legal `SpirvConst`, but can we have
// it as part of an `OpConstantComposite`?
match field_entry.val {
@ -630,9 +632,10 @@ impl<'tcx> BuilderSpirv<'tcx> {
)),
_ => Ok(()),
},
);
match (composite_legal, field_legal_in_composite) {
)
})
.reduce(|a, b| {
match (a, b) {
(Ok(()), Ok(())) => Ok(()),
(Err(illegal), Ok(())) | (Ok(()), Err(illegal)) => Err(illegal),
@ -643,11 +646,13 @@ impl<'tcx> BuilderSpirv<'tcx> {
// materialized at runtime in the same way `Shallow` can be.
(Err(illegal @ IllegalConst::Indirect(_)), Err(_))
| (Err(_), Err(illegal @ IllegalConst::Indirect(_)))
| (Err(illegal @ IllegalConst::Shallow(_)), Err(IllegalConst::Shallow(_))) => {
Err(illegal)
| (
Err(illegal @ IllegalConst::Shallow(_)),
Err(IllegalConst::Shallow(_)),
) => Err(illegal),
}
}
}),
})
.unwrap_or(Ok(())),
SpirvConst::PtrTo { pointee } => match self.id_to_const.borrow()[&pointee].legal {
Ok(()) => Ok(()),

View File

@ -105,7 +105,7 @@ impl SpirvBuilder {
}
}
});
std::mem::forget(thread);
std::mem::drop(thread);
Ok(first_result)
}
}

View File

@ -1,5 +1,8 @@
//! Types for handling memory ordering constraints for concurrent memory access.
// NOTE(eddyb) "&-masking with zero", likely due to `NONE = 0` in `bitflags!`.
#![allow(clippy::bad_bit_mask)]
/// Specification for how large of a scope some instructions should operate on - used when calling
/// functions that take a configurable scope.
#[derive(Debug, PartialEq, Eq)]

View File

@ -1,4 +1,8 @@
//! Ray-tracing data types
// NOTE(eddyb) "&-masking with zero", likely due to `NONE = 0` in `bitflags!`.
#![allow(clippy::bad_bit_mask)]
use crate::vector::Vector;
#[cfg(target_arch = "spirv")]
use core::arch::asm;