From 507c541ce46c46fdc0d6d5eacba7912bdc8e1fa5 Mon Sep 17 00:00:00 2001 From: Ding Xiang Fei Date: Thu, 28 Nov 2024 19:54:34 +0800 Subject: [PATCH] (not to be included in message) use fully qualified path on traits and macros for better readability --- rust/kernel/sync/arc.rs | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/rust/kernel/sync/arc.rs b/rust/kernel/sync/arc.rs index 12baa13743ebea..fe752c8e93dca4 100644 --- a/rust/kernel/sync/arc.rs +++ b/rust/kernel/sync/arc.rs @@ -23,10 +23,6 @@ use crate::{ try_init, types::{ForeignOwnable, Opaque}, }; -#[cfg(CONFIG_RUST_COERCE_POINTEE)] -use core::marker::CoercePointee; -#[cfg(not(CONFIG_RUST_COERCE_POINTEE))] -use core::marker::Unsize; use core::{ alloc::Layout, fmt, @@ -130,7 +126,7 @@ mod std_vendor; /// # Ok::<(), Error>(()) /// ``` #[repr(transparent)] -#[cfg_attr(CONFIG_RUST_COERCE_POINTEE, derive(CoercePointee))] +#[cfg_attr(CONFIG_RUST_COERCE_POINTEE, derive(core::marker::CoercePointee))] pub struct Arc { ptr: NonNull>, _p: PhantomData>, @@ -179,11 +175,11 @@ impl ArcInner { // This is to allow coercion from `Arc` to `Arc` if `T` can be converted to the // dynamically-sized type (DST) `U`. #[cfg(not(CONFIG_RUST_COERCE_POINTEE))] -impl, U: ?Sized> core::ops::CoerceUnsized> for Arc {} +impl, U: ?Sized> core::ops::CoerceUnsized> for Arc {} // This is to allow `Arc` to be dispatched on when `Arc` can be coerced into `Arc`. #[cfg(not(CONFIG_RUST_COERCE_POINTEE))] -impl, U: ?Sized> core::ops::DispatchFromDyn> for Arc {} +impl, U: ?Sized> core::ops::DispatchFromDyn> for Arc {} // SAFETY: It is safe to send `Arc` to another thread when the underlying `T` is `Sync` because // it effectively means sharing `&T` (which is safe because `T` is `Sync`); additionally, it needs @@ -480,7 +476,7 @@ impl From>> for Arc { /// # Ok::<(), Error>(()) /// ``` #[repr(transparent)] -#[cfg_attr(CONFIG_RUST_COERCE_POINTEE, derive(CoercePointee))] +#[cfg_attr(CONFIG_RUST_COERCE_POINTEE, derive(core::marker::CoercePointee))] pub struct ArcBorrow<'a, T: ?Sized + 'a> { inner: NonNull>, _p: PhantomData<&'a ()>, @@ -489,7 +485,7 @@ pub struct ArcBorrow<'a, T: ?Sized + 'a> { // This is to allow `ArcBorrow` to be dispatched on when `ArcBorrow` can be coerced into // `ArcBorrow`. #[cfg(not(CONFIG_RUST_COERCE_POINTEE))] -impl, U: ?Sized> core::ops::DispatchFromDyn> +impl, U: ?Sized> core::ops::DispatchFromDyn> for ArcBorrow<'_, T> { }