Skip to content

Commit 124bcb2

Browse files
Apply suggestions from code review
Co-authored-by: Jubilee <[email protected]>
1 parent 894f270 commit 124bcb2

File tree

8 files changed

+7
-30
lines changed

8 files changed

+7
-30
lines changed

library/alloc/src/bstr.rs

+4-16
Original file line numberDiff line numberDiff line change
@@ -180,10 +180,7 @@ impl Default for ByteString {
180180
//
181181
// #[unstable(feature = "bstr", issue = "134915")]
182182
// impl<'a, const N: usize> From<&'a [u8; N]> for ByteString {
183-
// /// Make a `ByteString` from a byte array ref.
184-
// ///
185-
// /// ## Cost
186-
// /// Allocates a new `Vec`
183+
// /// Allocate a new `ByteString` with a copy of the bytes in the array.
187184
// #[inline]
188185
// fn from(s: &'a [u8; N]) -> Self {
189186
// ByteString(s.as_slice().to_vec())
@@ -192,10 +189,7 @@ impl Default for ByteString {
192189
//
193190
// #[unstable(feature = "bstr", issue = "134915")]
194191
// impl<const N: usize> From<[u8; N]> for ByteString {
195-
// /// Make a `ByteString` from a byte array.
196-
// ///
197-
// /// ## Cost
198-
// /// Allocates a new `Vec`
192+
// /// Allocate a new `ByteString` with a copy of the bytes in the array.
199193
// #[inline]
200194
// fn from(s: [u8; N]) -> Self {
201195
// ByteString(s.as_slice().to_vec())
@@ -204,10 +198,7 @@ impl Default for ByteString {
204198
//
205199
// #[unstable(feature = "bstr", issue = "134915")]
206200
// impl<'a> From<&'a [u8]> for ByteString {
207-
// /// Make a `ByteString` from a byte slice.
208-
// ///
209-
// /// ## Cost
210-
// /// Allocates a new `Vec`
201+
// /// Allocate a new `ByteString` with a copy of the bytes in the array.
211202
// #[inline]
212203
// fn from(s: &'a [u8]) -> Self {
213204
// ByteString(s.to_vec())
@@ -236,10 +227,7 @@ impl From<ByteString> for Vec<u8> {
236227
//
237228
// #[unstable(feature = "bstr", issue = "134915")]
238229
// impl<'a> From<&'a str> for ByteString {
239-
// /// Make a `ByteString` from a string slices bytes.
240-
// ///
241-
// /// ## Cost
242-
// /// Allocates a new `Vec`
230+
// /// Allocate a new `ByteString` with a copy of the bytes in the slice.
243231
// #[inline]
244232
// fn from(s: &'a str) -> Self {
245233
// ByteString(s.as_bytes().to_vec())

library/alloc/src/collections/mod.rs

-1
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,6 @@ pub use realalloc::collections::TryReserveErrorKind;
130130
)]
131131
#[cfg(not(test))]
132132
impl From<TryReserveErrorKind> for TryReserveError {
133-
/// Wrap kind in `TryReserveError`.
134133
#[inline]
135134
fn from(kind: TryReserveErrorKind) -> Self {
136135
Self { kind }

library/core/src/num/error.rs

-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ impl Error for TryFromIntError {
2727

2828
#[stable(feature = "try_from", since = "1.34.0")]
2929
impl From<Infallible> for TryFromIntError {
30-
/// Convert `Infallible` into an error that can happen.
3130
#[inline]
3231
fn from(x: Infallible) -> TryFromIntError {
3332
match x {}
@@ -36,7 +35,6 @@ impl From<Infallible> for TryFromIntError {
3635

3736
#[unstable(feature = "never_type", issue = "35121")]
3837
impl From<!> for TryFromIntError {
39-
/// Convert `!` into an error that can happen.
4038
#[inline]
4139
fn from(never: !) -> TryFromIntError {
4240
// Match rather than coerce to make sure that code like

library/portable-simd/crates/core_simd/src/masks/full_masks.rs

-1
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,6 @@ where
238238
T: MaskElement,
239239
LaneCount<N>: SupportedLaneCount,
240240
{
241-
/// Return the `MaskElement` of the `Mask`
242241
#[inline]
243242
fn from(value: Mask<T, N>) -> Self {
244243
value.0

library/proc_macro/src/bridge/rpc.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -266,10 +266,7 @@ impl From<Box<dyn Any + Send>> for PanicMessage {
266266
}
267267

268268
impl From<PanicMessage> for Box<dyn Any + Send> {
269-
/// Return the inner message wrapped in `Box`.
270-
///
271-
/// ## Cost
272-
/// Allocates a new `Box` on the heap
269+
/// Wrap the inner message in a newly allocated `Box`.
273270
fn from(val: PanicMessage) -> Self {
274271
match val {
275272
PanicMessage::StaticStr(s) => Box::new(s),

library/proc_macro/src/lib.rs

-4
Original file line numberDiff line numberDiff line change
@@ -722,31 +722,27 @@ impl fmt::Debug for TokenTree {
722722

723723
#[stable(feature = "proc_macro_lib2", since = "1.29.0")]
724724
impl From<Group> for TokenTree {
725-
/// Wrap `Group` in `TokenTree::Group`
726725
fn from(g: Group) -> TokenTree {
727726
TokenTree::Group(g)
728727
}
729728
}
730729

731730
#[stable(feature = "proc_macro_lib2", since = "1.29.0")]
732731
impl From<Ident> for TokenTree {
733-
/// Wrap `Ident` in `TokenTree::Ident`
734732
fn from(g: Ident) -> TokenTree {
735733
TokenTree::Ident(g)
736734
}
737735
}
738736

739737
#[stable(feature = "proc_macro_lib2", since = "1.29.0")]
740738
impl From<Punct> for TokenTree {
741-
/// Wrap `Punct` in `TokenTree::Punct`
742739
fn from(g: Punct) -> TokenTree {
743740
TokenTree::Punct(g)
744741
}
745742
}
746743

747744
#[stable(feature = "proc_macro_lib2", since = "1.29.0")]
748745
impl From<Literal> for TokenTree {
749-
/// Wrap `Literal` in `TokenTree::Literal`
750746
fn from(g: Literal) -> TokenTree {
751747
TokenTree::Literal(g)
752748
}

library/std/src/os/xous/ffi/definitions.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ impl Into<[u32; 4]> for ServerAddress {
266266
pub(crate) struct ThreadId(usize);
267267

268268
impl From<usize> for ThreadId {
269-
/// Make a `ThreadId` with `usize` as inner
269+
/// Make a `ThreadId` with `usize` as the id
270270
fn from(src: usize) -> ThreadId {
271271
ThreadId(src)
272272
}

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ impl PartialEq<str> for EnvKey {
121121
// Environment variable keys should preserve their original case even though
122122
// they are compared using a caseless string mapping.
123123
impl From<OsString> for EnvKey {
124-
/// Create a new `EnvKey` from `OsString` and it's encode wide iter.
124+
/// Create a new `EnvKey` from `OsString` and its encode wide iter.
125125
///
126126
/// ## Cost
127127
/// Has to collect `OsString.encode_wide` which allocates a new `Vec`

0 commit comments

Comments
 (0)