Skip to content

Commit 858b821

Browse files
committed
Apply suggestions from code review
1 parent 124bcb2 commit 858b821

File tree

5 files changed

+13
-29
lines changed

5 files changed

+13
-29
lines changed

library/alloc/src/bstr.rs

+6-8
Original file line numberDiff line numberDiff line change
@@ -245,10 +245,7 @@ impl From<ByteString> for Vec<u8> {
245245

246246
#[unstable(feature = "bstr", issue = "134915")]
247247
impl<'a> From<&'a ByteStr> for ByteString {
248-
/// Convert the `ByteStr` to a `Vec` then wrap it in a `ByteString`.
249-
///
250-
/// ## Cost
251-
/// Allocates a new `Vec`
248+
/// Allocates a `ByteString` containing the bytes of `ByteStr`.
252249
#[inline]
253250
fn from(s: &'a ByteStr) -> Self {
254251
ByteString(s.0.to_vec())
@@ -642,7 +639,7 @@ impl From<Box<ByteStr>> for Box<[u8]> {
642639
#[unstable(feature = "bstr", issue = "134915")]
643640
#[cfg(not(no_rc))]
644641
impl From<Rc<[u8]>> for Rc<ByteStr> {
645-
/// Create a `Rc<[u8]>` from `Rc<ByteStr>`s raw.
642+
/// Create an `Rc<[u8]>` from the inner bytes of `Rc<ByteStr>`.
646643
#[inline]
647644
fn from(s: Rc<[u8]>) -> Rc<ByteStr> {
648645
// SAFETY: `ByteStr` is a transparent wrapper around `[u8]`.
@@ -653,7 +650,7 @@ impl From<Rc<[u8]>> for Rc<ByteStr> {
653650
#[unstable(feature = "bstr", issue = "134915")]
654651
#[cfg(not(no_rc))]
655652
impl From<Rc<ByteStr>> for Rc<[u8]> {
656-
/// Create a `Rc<ByteStr>` from `Rc<[u8]>`s raw.
653+
/// Create a `Rc<ByteStr>` from the bytes of `Rc<[u8]>`.
657654
#[inline]
658655
fn from(s: Rc<ByteStr>) -> Rc<[u8]> {
659656
// SAFETY: `ByteStr` is a transparent wrapper around `[u8]`.
@@ -664,7 +661,7 @@ impl From<Rc<ByteStr>> for Rc<[u8]> {
664661
#[unstable(feature = "bstr", issue = "134915")]
665662
#[cfg(all(not(no_rc), not(no_sync), target_has_atomic = "ptr"))]
666663
impl From<Arc<[u8]>> for Arc<ByteStr> {
667-
/// Create a `Arc<ByteStr>` from `Arc<[u8]>`s raw.
664+
/// Create an `Arc<ByteStr>` from the bytes of `Arc<[u8]>`.
668665
#[inline]
669666
fn from(s: Arc<[u8]>) -> Arc<ByteStr> {
670667
// SAFETY: `ByteStr` is a transparent wrapper around `[u8]`.
@@ -675,7 +672,8 @@ impl From<Arc<[u8]>> for Arc<ByteStr> {
675672
#[unstable(feature = "bstr", issue = "134915")]
676673
#[cfg(all(not(no_rc), not(no_sync), target_has_atomic = "ptr"))]
677674
impl From<Arc<ByteStr>> for Arc<[u8]> {
678-
/// Create a `Arc<ByteStr>` from `Arc<[u8]>`s raw.
675+
/// Create a `Arc<[u8]>` from the inner bytes of `Arc<ByteStr>`.
676+
679677
#[inline]
680678
fn from(s: Arc<ByteStr>) -> Arc<[u8]> {
681679
// SAFETY: `ByteStr` is a transparent wrapper around `[u8]`.

library/alloc/src/task.rs

+4-16
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,7 @@ pub trait Wake {
107107
#[cfg(target_has_atomic = "ptr")]
108108
#[stable(feature = "wake_trait", since = "1.51.0")]
109109
impl<W: Wake + Send + Sync + 'static> From<Arc<W>> for Waker {
110-
/// Use a [`Wake`]-able type as a `Waker`.
111-
///
112-
/// ## Cost
113-
/// No heap allocations or atomic operations are used for this conversion.
110+
/// Use a [`Wake`]-able type as a `Waker`. Without any heap allocations or atomic operations.
114111
fn from(waker: Arc<W>) -> Waker {
115112
// SAFETY: This is safe because raw_waker safely constructs
116113
// a RawWaker from Arc<W>.
@@ -120,10 +117,7 @@ impl<W: Wake + Send + Sync + 'static> From<Arc<W>> for Waker {
120117
#[cfg(target_has_atomic = "ptr")]
121118
#[stable(feature = "wake_trait", since = "1.51.0")]
122119
impl<W: Wake + Send + Sync + 'static> From<Arc<W>> for RawWaker {
123-
/// Use a `Wake`-able type as a `RawWaker`.
124-
///
125-
/// ## Cost
126-
/// No heap allocations or atomic operations are used for this conversion.
120+
/// Use a `Wake`-able type as a `RawWaker`. Without any heap allocations or atomic operations.
127121
fn from(waker: Arc<W>) -> RawWaker {
128122
raw_waker(waker)
129123
}
@@ -288,10 +282,7 @@ pub trait LocalWake {
288282

289283
#[unstable(feature = "local_waker", issue = "118959")]
290284
impl<W: LocalWake + 'static> From<Rc<W>> for LocalWaker {
291-
/// Use a `Wake`-able type as a `LocalWaker`.
292-
///
293-
/// ## Cost
294-
/// No heap allocations or atomic operations are used for this conversion.
285+
/// Use a `Wake`-able type as a `LocalWaker`. Without any heap allocations or atomic operations.
295286
fn from(waker: Rc<W>) -> LocalWaker {
296287
// SAFETY: This is safe because raw_waker safely constructs
297288
// a RawWaker from Rc<W>.
@@ -301,10 +292,7 @@ impl<W: LocalWake + 'static> From<Rc<W>> for LocalWaker {
301292
#[allow(ineffective_unstable_trait_impl)]
302293
#[unstable(feature = "local_waker", issue = "118959")]
303294
impl<W: LocalWake + 'static> From<Rc<W>> for RawWaker {
304-
/// Use a `Wake`-able type as a `RawWaker`.
305-
///
306-
/// ## Cost
307-
/// No heap allocations or atomic operations are used for this conversion.
295+
/// Use a `Wake`-able type as a `RawWaker`. Without any heap allocations or atomic operations.
308296
fn from(waker: Rc<W>) -> RawWaker {
309297
local_raw_waker(waker)
310298
}

library/std/src/sys/fs/windows.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -1057,8 +1057,7 @@ impl FileAttr {
10571057
}
10581058
}
10591059
impl From<c::WIN32_FIND_DATAW> for FileAttr {
1060-
/// Map `c::WIN32_FIND_DATAW`s fields to a `FileAttr`,
1061-
/// with some conditionals for `file_size` and `reparse_tag`.
1060+
/// Map `c::WIN32_FIND_DATAW`s fields to a `FileAttr`.
10621061
fn from(wfd: c::WIN32_FIND_DATAW) -> Self {
10631062
FileAttr {
10641063
attributes: wfd.dwFileAttributes,

src/tools/miri/src/concurrency/vector_clock.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ impl Idx for VectorIdx {
3434
}
3535

3636
impl From<u32> for VectorIdx {
37-
/// Create new `VectorIdx` with `u32` as inner.
37+
/// Create new `VectorIdx` with the inner id of `u32`.
3838
#[inline]
3939
fn from(id: u32) -> Self {
4040
Self(id)

src/tools/miri/src/shims/io_error.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ pub enum IoError {
1414
pub use self::IoError::*;
1515

1616
impl From<io::Error> for IoError {
17-
/// Wrap `io::Error` in `HostError`.
1817
fn from(value: io::Error) -> Self {
1918
IoError::HostError(value)
2019
}
@@ -28,7 +27,7 @@ impl From<io::ErrorKind> for IoError {
2827
}
2928

3029
impl From<Scalar> for IoError {
31-
/// Wrap `Scalar` in `Raw`.
30+
/// Create a `Raw` `IoError` with a `Scalar`.
3231
fn from(value: Scalar) -> Self {
3332
IoError::Raw(value)
3433
}

0 commit comments

Comments
 (0)