summaryrefslogtreecommitdiff
path: root/drivers/gpu/nova-core/num.rs
diff options
context:
space:
mode:
authorAlexandre Courbot <acourbot@nvidia.com>2025-10-27 23:12:31 +0900
committerAlexandre Courbot <acourbot@nvidia.com>2025-11-08 08:22:45 +0900
commit84e2b401bcc551e7c2e1a995f90cce421bce5bfd (patch)
tree22c198ec547b70bb4dce9ade00601d5eb0a8eb84 /drivers/gpu/nova-core/num.rs
parent5525ac03ca7adec61d39f3fd3a143b5e294bdff7 (diff)
downloadlinux-84e2b401bcc551e7c2e1a995f90cce421bce5bfd.tar.gz
linux-84e2b401bcc551e7c2e1a995f90cce421bce5bfd.zip
gpu: nova-core: replace use of `as` with functions from `num`
Use the newly-introduced `num` module to replace the use of `as` wherever it is safe to do. This ensures that a given conversion cannot lose data if its source or destination type ever changes. Acked-by: Danilo Krummrich <dakr@kernel.org> [acourbot@nvidia.com: fix merge conflicts after rebase.] Signed-off-by: Alexandre Courbot <acourbot@nvidia.com> Message-ID: <20251029-nova-as-v3-5-6a30c7333ad9@nvidia.com>
Diffstat (limited to 'drivers/gpu/nova-core/num.rs')
-rw-r--r--drivers/gpu/nova-core/num.rs2
1 files changed, 0 insertions, 2 deletions
diff --git a/drivers/gpu/nova-core/num.rs b/drivers/gpu/nova-core/num.rs
index 457a1303640f..92a91b9e30de 100644
--- a/drivers/gpu/nova-core/num.rs
+++ b/drivers/gpu/nova-core/num.rs
@@ -106,7 +106,6 @@ impl_safe_as!(usize as { u32 });
///
/// assert_eq!(usize::from_safe_cast(0xf00u32), 0xf00u32 as usize);
/// ```
-#[expect(unused)]
pub(crate) trait FromSafeCast<T> {
/// Create a `Self` from `value`. This operation is guaranteed to be lossless.
fn from_safe_cast(value: T) -> Self;
@@ -150,7 +149,6 @@ impl FromSafeCast<u64> for usize {
///
/// assert_eq!(0xf00u32.into_safe_cast(), 0xf00u32 as usize);
/// ```
-#[expect(unused)]
pub(crate) trait IntoSafeCast<T> {
/// Convert `self` into a `T`. This operation is guaranteed to be lossless.
fn into_safe_cast(self) -> T;