File tree 10 files changed +15
-27
lines changed
src/tools/clippy/clippy_lints/src/attrs 10 files changed +15
-27
lines changed Original file line number Diff line number Diff line change @@ -624,7 +624,7 @@ impl Clone for Box<ByteStr> {
624
624
625
625
#[ unstable( feature = "bstr" , issue = "134915" ) ]
626
626
impl < ' a > From < & ' a ByteStr > for Cow < ' a , ByteStr > {
627
- /// Create a `Borrowed` cow from a `ByteStr `.
627
+ /// Wrap `ByteStr` in `Cow::Borrowed `.
628
628
#[ inline]
629
629
fn from ( s : & ' a ByteStr ) -> Self {
630
630
Cow :: Borrowed ( s)
@@ -633,7 +633,7 @@ impl<'a> From<&'a ByteStr> for Cow<'a, ByteStr> {
633
633
634
634
#[ unstable( feature = "bstr" , issue = "134915" ) ]
635
635
impl From < Box < [ u8 ] > > for Box < ByteStr > {
636
- /// Create a `Box<[u8] >` from `Box<ByteStr>`s raw .
636
+ /// Move the bytes from `Box<ByteStr >` to `Box<[u8]>`, this does not allocate new memory .
637
637
#[ inline]
638
638
fn from ( s : Box < [ u8 ] > ) -> Box < ByteStr > {
639
639
// SAFETY: `ByteStr` is a transparent wrapper around `[u8]`.
Original file line number Diff line number Diff line change @@ -178,24 +178,12 @@ impl Error for TryFromSliceError {
178
178
179
179
#[ stable( feature = "try_from_slice_error" , since = "1.36.0" ) ]
180
180
impl From < Infallible > for TryFromSliceError {
181
- /// Match `Infallible` into `TryFromSliceError` .
181
+ /// Convert `Infallible` into an error that can happen .
182
182
fn from ( x : Infallible ) -> TryFromSliceError {
183
183
match x { }
184
184
}
185
185
}
186
186
187
- #[ unstable( feature = "never_type" , issue = "35121" ) ]
188
- impl From < !> for TryFromSliceError {
189
- /// Match `!` into `TryFromSliceError`.
190
- #[ inline]
191
- fn from ( never : !) -> TryFromSliceError {
192
- // Match rather than coerce to make sure that code like
193
- // `From<Infallible> for TryFromSliceError` above will keep working
194
- // when `Infallible` becomes an alias to `!`.
195
- match never { }
196
- }
197
- }
198
-
199
187
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
200
188
impl < T , const N : usize > AsRef < [ T ] > for [ T ; N ] {
201
189
#[ inline]
Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ pub enum Alignment {
36
36
#[ doc( hidden) ]
37
37
#[ unstable( feature = "fmt_internals" , reason = "internal to standard library" , issue = "none" ) ]
38
38
impl From < rt:: Alignment > for Option < Alignment > {
39
- /// Match the `Alignment` to the `Some` equivalent, `Unknown` matches `None`.
39
+ /// Match the `rt:: Alignment` to the `Some` equivalent, `Unknown` matches `None`.
40
40
fn from ( value : rt:: Alignment ) -> Self {
41
41
match value {
42
42
rt:: Alignment :: Left => Some ( Alignment :: Left ) ,
Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ impl Error for TryFromIntError {
27
27
28
28
#[ stable( feature = "try_from" , since = "1.34.0" ) ]
29
29
impl From < Infallible > for TryFromIntError {
30
- /// Match `Infallible` into `TryFromIntError` .
30
+ /// Convert `Infallible` into an error that can happen .
31
31
#[ inline]
32
32
fn from ( x : Infallible ) -> TryFromIntError {
33
33
match x { }
@@ -36,7 +36,7 @@ impl From<Infallible> for TryFromIntError {
36
36
37
37
#[ unstable( feature = "never_type" , issue = "35121" ) ]
38
38
impl From < !> for TryFromIntError {
39
- /// Match `!` into `TryFromIntError` .
39
+ /// Convert `!` into an error that can happen .
40
40
#[ inline]
41
41
fn from ( never : !) -> TryFromIntError {
42
42
// Match rather than coerce to make sure that code like
Original file line number Diff line number Diff line change @@ -290,7 +290,7 @@ impl<T> From<NonZero<T>> for T
290
290
where
291
291
T : ZeroablePrimitive ,
292
292
{
293
- /// Get the inner num of `NonZero` .
293
+ /// Returns the contained value as a primitive type .
294
294
#[ inline]
295
295
fn from ( nonzero : NonZero < T > ) -> Self {
296
296
// Call `get` method to keep range information.
Original file line number Diff line number Diff line change @@ -189,7 +189,7 @@ impl TryFrom<usize> for Alignment {
189
189
190
190
#[ unstable( feature = "ptr_alignment_type" , issue = "102070" ) ]
191
191
impl From < Alignment > for NonZero < usize > {
192
- /// `Alignment` is non zero so the inner enum value is returned
192
+ /// `Alignment` is non zero so the inner value is returned
193
193
#[ inline]
194
194
fn from ( align : Alignment ) -> NonZero < usize > {
195
195
align. as_nonzero ( )
@@ -198,7 +198,7 @@ impl From<Alignment> for NonZero<usize> {
198
198
199
199
#[ unstable( feature = "ptr_alignment_type" , issue = "102070" ) ]
200
200
impl From < Alignment > for usize {
201
- /// `Alignment` is unsined so the inner enum value is returned
201
+ /// `Alignment` is unsined so the inner value is returned
202
202
#[ inline]
203
203
fn from ( align : Alignment ) -> usize {
204
204
align. as_usize ( )
Original file line number Diff line number Diff line change @@ -269,7 +269,7 @@ impl From<PanicMessage> for Box<dyn Any + Send> {
269
269
/// Return the inner wrapped in `Box`.
270
270
///
271
271
/// ## Cost
272
- /// Allocates a new `Box` on the heep
272
+ /// Allocates a new `Box` on the heap
273
273
fn from ( val : PanicMessage ) -> Self {
274
274
match val {
275
275
PanicMessage :: StaticStr ( s) => Box :: new ( s) ,
Original file line number Diff line number Diff line change @@ -140,7 +140,7 @@ impl From<&OsStr> for EnvKey {
140
140
/// Uses `EnvKey::From<OsString>` to convert the `&OsStr`.
141
141
///
142
142
/// ## Cost
143
- /// Converts `&OsStr` to `OsString` which does a heep allocation
143
+ /// Converts `&OsStr` to `OsString` which does a heap allocation
144
144
fn from ( k : & OsStr ) -> Self {
145
145
Self :: from ( k. to_os_string ( ) )
146
146
}
Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ impl From<&AttrKind> for SimpleAttrKind {
19
19
/// if it's a `DocComment` then `Doc` is returned with no conversion.
20
20
///
21
21
/// ## Cost
22
- /// If `AttrKind` is `DocComment` it's free, however if it's `Normal` their is heep allocation
22
+ /// If `AttrKind` is `DocComment` it's free, however if it's `Normal` their is heap allocation
23
23
fn from ( value : & AttrKind ) -> Self {
24
24
match value {
25
25
AttrKind :: Normal ( attr) => {
Original file line number Diff line number Diff line change @@ -7,9 +7,9 @@ LL | Err("")?;
7
7
| this can't be annotated with `?` because it has type `Result<_, &str>`
8
8
|
9
9
= note: the question mark operation (`?`) implicitly performs a conversion on the error value using the `From` trait
10
- = help: the following other types implement trait `From<T>`:
11
- `TryFromSliceError` implements ` From<!>`
12
- `TryFromSliceError` implements `From<Infallible> `
10
+ = help: the trait `From<&str>` is not implemented for `TryFromSliceError`
11
+ but trait ` From<Infallible>` is implemented for it
12
+ = help: for that trait implementation, expected `Infallible`, found `&str `
13
13
14
14
error[E0271]: type mismatch resolving `<Result<i32, i32> as Try>::Output == &str`
15
15
--> $DIR/try-block-bad-type.rs:12:9
You can’t perform that action at this time.
0 commit comments