Skip to content

Commit c2811a6

Browse files
TheSven73ojeda
andauthored
Apply @ojeda's suggestions from code review
This will be squashed in v2. Co-authored-by: Miguel Ojeda <[email protected]>
1 parent e451b59 commit c2811a6

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

rust/kernel/traits.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11
// SPDX-License-Identifier: GPL-2.0
22

3-
//! Traits useful to Drivers, and their implementations for common types.
3+
//! Traits useful to drivers, and their implementations for common types.
44
55
use core::{ops::Deref, pin::Pin};
66

77
use alloc::{alloc::AllocError, sync::Arc};
88

9-
/// Trait which implements a fallible version of `pin()` for any pointer type.
9+
/// Trait which provides a fallible version of `pin()` for pointer types.
1010
///
11-
/// Common pointer types which implement `pin()` include `Box`, `Arc` and `Rc`.
11+
/// Common pointer types which implement a `pin()` method include [`Box`], [`Arc`] and [`Rc`].
1212
pub trait TryPin<P: Deref> {
13-
/// Constructs a new Pin<pointer<T>>. If T does not implement Unpin, then data
13+
/// Constructs a new `Pin<pointer<T>>`. If `T` does not implement [`Unpin`], then data
1414
/// will be pinned in memory and unable to be moved. An error will be returned
1515
/// if allocation fails.
1616
fn try_pin(data: P::Target) -> core::result::Result<Pin<P>, AllocError>;
1717
}
1818

1919
impl<T> TryPin<Arc<T>> for Arc<T> {
2020
fn try_pin(data: T) -> core::result::Result<Pin<Arc<T>>, AllocError> {
21-
// SAFETY: the data T is exposed only through a `Pin<Arc<T>>`, which
21+
// SAFETY: the data `T` is exposed only through a `Pin<Arc<T>>`, which
2222
// does not allow data to move out of the `Arc`. Therefore it can
2323
// never be moved.
2424
Ok(unsafe { Pin::new_unchecked(Arc::try_new(data)?) })

0 commit comments

Comments
 (0)