mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 16:24:46 +00:00
Rollup merge of #131403 - practicalrs:fix_needless_lifetimes_p2, r=petrochenkov
Fix needless_lifetimes in rustc_serialize Hi, This PR fixes the following clipy warnings: ``` warning: the following explicit lifetimes could be elided: 'a --> compiler/rustc_serialize/src/serialize.rs:328:6 | 328 | impl<'a, S: Encoder, T: Encodable<S>> Encodable<S> for Cow<'a, [T]> | ^^ ^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes = note: `#[warn(clippy::needless_lifetimes)]` on by default help: elide the lifetimes | 328 - impl<'a, S: Encoder, T: Encodable<S>> Encodable<S> for Cow<'a, [T]> 328 + impl<S: Encoder, T: Encodable<S>> Encodable<S> for Cow<'_, [T]> | warning: the following explicit lifetimes could be elided: 'a --> compiler/rustc_serialize/src/serialize.rs:348:6 | 348 | impl<'a, S: Encoder> Encodable<S> for Cow<'a, str> { | ^^ ^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes help: elide the lifetimes | 348 - impl<'a, S: Encoder> Encodable<S> for Cow<'a, str> { 348 + impl<S: Encoder> Encodable<S> for Cow<'_, str> { | warning: the following explicit lifetimes could be elided: 'a --> compiler/rustc_serialize/src/serialize.rs:355:6 | 355 | impl<'a, D: Decoder> Decodable<D> for Cow<'a, str> { | ^^ ^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes help: elide the lifetimes | 355 - impl<'a, D: Decoder> Decodable<D> for Cow<'a, str> { 355 + impl<D: Decoder> Decodable<D> for Cow<'_, str> { ``` Best regards, Michal
This commit is contained in:
commit
50f7e80423
@ -325,7 +325,7 @@ impl<D: Decoder, const N: usize> Decodable<D> for [u8; N] {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, S: Encoder, T: Encodable<S>> Encodable<S> for Cow<'a, [T]>
|
||||
impl<S: Encoder, T: Encodable<S>> Encodable<S> for Cow<'_, [T]>
|
||||
where
|
||||
[T]: ToOwned<Owned = Vec<T>>,
|
||||
{
|
||||
@ -345,14 +345,14 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, S: Encoder> Encodable<S> for Cow<'a, str> {
|
||||
impl<S: Encoder> Encodable<S> for Cow<'_, str> {
|
||||
fn encode(&self, s: &mut S) {
|
||||
let val: &str = self;
|
||||
val.encode(s)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, D: Decoder> Decodable<D> for Cow<'a, str> {
|
||||
impl<D: Decoder> Decodable<D> for Cow<'_, str> {
|
||||
fn decode(d: &mut D) -> Cow<'static, str> {
|
||||
let v: String = Decodable::decode(d);
|
||||
Cow::Owned(v)
|
||||
|
Loading…
Reference in New Issue
Block a user