File tree Expand file tree Collapse file tree 10 files changed +15
-27
lines changed
src/tools/clippy/clippy_lints/src/attrs Expand file tree Collapse file tree 10 files changed +15
-27
lines changed Original file line number Diff line number Diff line change @@ -642,7 +642,7 @@ impl Clone for Box<ByteStr> {
642642#[ cfg( not( test) ) ] // https://github.com/rust-lang/rust/issues/135100
643643#[ unstable( feature = "bstr" , issue = "134915" ) ]
644644impl < ' a > From < & ' a ByteStr > for Cow < ' a , ByteStr > {
645- /// Create a `Borrowed` cow from a `ByteStr `.
645+ /// Wrap `ByteStr` in `Cow::Borrowed `.
646646 #[ inline]
647647 fn from ( s : & ' a ByteStr ) -> Self {
648648 Cow :: Borrowed ( s)
@@ -652,7 +652,7 @@ impl<'a> From<&'a ByteStr> for Cow<'a, ByteStr> {
652652#[ cfg( not( test) ) ] // https://github.com/rust-lang/rust/issues/135100
653653#[ unstable( feature = "bstr" , issue = "134915" ) ]
654654impl From < Box < [ u8 ] > > for Box < ByteStr > {
655- /// Create a `Box<[u8] >` from `Box<ByteStr>`s raw .
655+ /// Move the bytes from `Box<ByteStr >` to `Box<[u8]>`, this does not allocate new memory .
656656 #[ inline]
657657 fn from ( s : Box < [ u8 ] > ) -> Box < ByteStr > {
658658 // 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 {
178178
179179#[ stable( feature = "try_from_slice_error" , since = "1.36.0" ) ]
180180impl From < Infallible > for TryFromSliceError {
181- /// Match `Infallible` into `TryFromSliceError` .
181+ /// Convert `Infallible` into an error that can happen .
182182 fn from ( x : Infallible ) -> TryFromSliceError {
183183 match x { }
184184 }
185185}
186186
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-
199187#[ stable( feature = "rust1" , since = "1.0.0" ) ]
200188impl < T , const N : usize > AsRef < [ T ] > for [ T ; N ] {
201189 #[ inline]
Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ pub enum Alignment {
3636#[ doc( hidden) ]
3737#[ unstable( feature = "fmt_internals" , reason = "internal to standard library" , issue = "none" ) ]
3838impl 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`.
4040 fn from ( value : rt:: Alignment ) -> Self {
4141 match value {
4242 rt:: Alignment :: Left => Some ( Alignment :: Left ) ,
Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ impl Error for TryFromIntError {
2727
2828#[ stable( feature = "try_from" , since = "1.34.0" ) ]
2929impl From < Infallible > for TryFromIntError {
30- /// Match `Infallible` into `TryFromIntError` .
30+ /// Convert `Infallible` into an error that can happen .
3131 #[ inline]
3232 fn from ( x : Infallible ) -> TryFromIntError {
3333 match x { }
@@ -36,7 +36,7 @@ impl From<Infallible> for TryFromIntError {
3636
3737#[ unstable( feature = "never_type" , issue = "35121" ) ]
3838impl From < !> for TryFromIntError {
39- /// Match `!` into `TryFromIntError` .
39+ /// Convert `!` into an error that can happen .
4040 #[ inline]
4141 fn from ( never : !) -> TryFromIntError {
4242 // Match rather than coerce to make sure that code like
Original file line number Diff line number Diff line change @@ -287,7 +287,7 @@ impl<T> From<NonZero<T>> for T
287287where
288288 T : ZeroablePrimitive ,
289289{
290- /// Get the inner num of `NonZero` .
290+ /// Returns the contained value as a primitive type .
291291 #[ inline]
292292 fn from ( nonzero : NonZero < T > ) -> Self {
293293 // 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 {
189189
190190#[ unstable( feature = "ptr_alignment_type" , issue = "102070" ) ]
191191impl 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
193193 #[ inline]
194194 fn from ( align : Alignment ) -> NonZero < usize > {
195195 align. as_nonzero ( )
@@ -198,7 +198,7 @@ impl From<Alignment> for NonZero<usize> {
198198
199199#[ unstable( feature = "ptr_alignment_type" , issue = "102070" ) ]
200200impl 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
202202 #[ inline]
203203 fn from ( align : Alignment ) -> usize {
204204 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> {
269269 /// Return the inner wrapped in `Box`.
270270 ///
271271 /// ## Cost
272- /// Allocates a new `Box` on the heep
272+ /// Allocates a new `Box` on the heap
273273 fn from ( val : PanicMessage ) -> Self {
274274 match val {
275275 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 {
140140 /// Uses `EnvKey::From<OsString>` to convert the `&OsStr`.
141141 ///
142142 /// ## Cost
143- /// Converts `&OsStr` to `OsString` which does a heep allocation
143+ /// Converts `&OsStr` to `OsString` which does a heap allocation
144144 fn from ( k : & OsStr ) -> Self {
145145 Self :: from ( k. to_os_string ( ) )
146146 }
Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ impl From<&AttrKind> for SimpleAttrKind {
1919 /// if it's a `DocComment` then `Doc` is returned with no conversion.
2020 ///
2121 /// ## 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
2323 fn from ( value : & AttrKind ) -> Self {
2424 match value {
2525 AttrKind :: Normal ( attr) => {
Original file line number Diff line number Diff line change @@ -7,9 +7,9 @@ LL | Err("")?;
77 | this can't be annotated with `?` because it has type `Result<_, &str>`
88 |
99 = 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 `
1313
1414error[E0271]: type mismatch resolving `<Result<i32, i32> as Try>::Output == &str`
1515 --> $DIR/try-block-bad-type.rs:12:9
You can’t perform that action at this time.
0 commit comments