diff options
| author | Pietro Albini <pietro@pietroalbini.org> | 2018-10-02 22:54:33 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-10-02 22:54:33 +0200 |
| commit | 7e571eead8e4356dcb9b4f4aa92ffcdc29336803 (patch) | |
| tree | 49c4d78de9ae26b8957c5be8f15668b4fafbf3e7 /src/libcore | |
| parent | 32c1454a87e22431e79d189eaac6b89747460b50 (diff) | |
| parent | d4840da77993d052bae2a900163026602ac89d3c (diff) | |
| download | rust-7e571eead8e4356dcb9b4f4aa92ffcdc29336803.tar.gz rust-7e571eead8e4356dcb9b4f4aa92ffcdc29336803.zip | |
Rollup merge of #54687 - scottmcm:more-elision, r=dtolnay
Use impl_header_lifetime_elision in libcore The feature is approved for stabilization, so let's use it to remove about 300 `'a`s. Tracking issue for the feature: https://github.com/rust-lang/rust/issues/15872
Diffstat (limited to 'src/libcore')
| -rw-r--r-- | src/libcore/borrow.rs | 6 | ||||
| -rw-r--r-- | src/libcore/cell.rs | 18 | ||||
| -rw-r--r-- | src/libcore/clone.rs | 2 | ||||
| -rw-r--r-- | src/libcore/cmp.rs | 12 | ||||
| -rw-r--r-- | src/libcore/convert.rs | 6 | ||||
| -rw-r--r-- | src/libcore/fmt/builders.rs | 2 | ||||
| -rw-r--r-- | src/libcore/fmt/mod.rs | 26 | ||||
| -rw-r--r-- | src/libcore/hash/mod.rs | 6 | ||||
| -rw-r--r-- | src/libcore/iter/iterator.rs | 2 | ||||
| -rw-r--r-- | src/libcore/iter/traits.rs | 6 | ||||
| -rw-r--r-- | src/libcore/lib.rs | 1 | ||||
| -rw-r--r-- | src/libcore/marker.rs | 10 | ||||
| -rw-r--r-- | src/libcore/ops/deref.rs | 6 | ||||
| -rw-r--r-- | src/libcore/ops/function.rs | 10 | ||||
| -rw-r--r-- | src/libcore/ops/generator.rs | 2 | ||||
| -rw-r--r-- | src/libcore/ops/range.rs | 10 | ||||
| -rw-r--r-- | src/libcore/option.rs | 16 | ||||
| -rw-r--r-- | src/libcore/panic.rs | 4 | ||||
| -rw-r--r-- | src/libcore/result.rs | 16 | ||||
| -rw-r--r-- | src/libcore/slice/mod.rs | 96 | ||||
| -rw-r--r-- | src/libcore/str/mod.rs | 34 | ||||
| -rw-r--r-- | src/libcore/str/pattern.rs | 4 | ||||
| -rw-r--r-- | src/libcore/tests/iter.rs | 2 | ||||
| -rw-r--r-- | src/libcore/tests/lib.rs | 1 |
24 files changed, 150 insertions, 148 deletions
diff --git a/src/libcore/borrow.rs b/src/libcore/borrow.rs index f45a32d4b94..84d4b217841 100644 --- a/src/libcore/borrow.rs +++ b/src/libcore/borrow.rs @@ -226,16 +226,16 @@ impl<T: ?Sized> BorrowMut<T> for T { } #[stable(feature = "rust1", since = "1.0.0")] -impl<'a, T: ?Sized> Borrow<T> for &'a T { +impl<T: ?Sized> Borrow<T> for &T { fn borrow(&self) -> &T { &**self } } #[stable(feature = "rust1", since = "1.0.0")] -impl<'a, T: ?Sized> Borrow<T> for &'a mut T { +impl<T: ?Sized> Borrow<T> for &mut T { fn borrow(&self) -> &T { &**self } } #[stable(feature = "rust1", since = "1.0.0")] -impl<'a, T: ?Sized> BorrowMut<T> for &'a mut T { +impl<T: ?Sized> BorrowMut<T> for &mut T { fn borrow_mut(&mut self) -> &mut T { &mut **self } } diff --git a/src/libcore/cell.rs b/src/libcore/cell.rs index 009aba5f598..ec7d366c3f5 100644 --- a/src/libcore/cell.rs +++ b/src/libcore/cell.rs @@ -1092,7 +1092,7 @@ impl<'b> BorrowRef<'b> { } } -impl<'b> Drop for BorrowRef<'b> { +impl Drop for BorrowRef<'_> { #[inline] fn drop(&mut self) { let borrow = self.borrow.get(); @@ -1101,9 +1101,9 @@ impl<'b> Drop for BorrowRef<'b> { } } -impl<'b> Clone for BorrowRef<'b> { +impl Clone for BorrowRef<'_> { #[inline] - fn clone(&self) -> BorrowRef<'b> { + fn clone(&self) -> Self { // Since this Ref exists, we know the borrow flag // is a reading borrow. let borrow = self.borrow.get(); @@ -1127,7 +1127,7 @@ pub struct Ref<'b, T: ?Sized + 'b> { } #[stable(feature = "rust1", since = "1.0.0")] -impl<'b, T: ?Sized> Deref for Ref<'b, T> { +impl<T: ?Sized> Deref for Ref<'_, T> { type Target = T; #[inline] @@ -1219,7 +1219,7 @@ impl<'b, T: ?Sized> Ref<'b, T> { impl<'b, T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<Ref<'b, U>> for Ref<'b, T> {} #[stable(feature = "std_guard_impls", since = "1.20.0")] -impl<'a, T: ?Sized + fmt::Display> fmt::Display for Ref<'a, T> { +impl<T: ?Sized + fmt::Display> fmt::Display for Ref<'_, T> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { self.value.fmt(f) } @@ -1305,7 +1305,7 @@ struct BorrowRefMut<'b> { borrow: &'b Cell<BorrowFlag>, } -impl<'b> Drop for BorrowRefMut<'b> { +impl Drop for BorrowRefMut<'_> { #[inline] fn drop(&mut self) { let borrow = self.borrow.get(); @@ -1356,7 +1356,7 @@ pub struct RefMut<'b, T: ?Sized + 'b> { } #[stable(feature = "rust1", since = "1.0.0")] -impl<'b, T: ?Sized> Deref for RefMut<'b, T> { +impl<T: ?Sized> Deref for RefMut<'_, T> { type Target = T; #[inline] @@ -1366,7 +1366,7 @@ impl<'b, T: ?Sized> Deref for RefMut<'b, T> { } #[stable(feature = "rust1", since = "1.0.0")] -impl<'b, T: ?Sized> DerefMut for RefMut<'b, T> { +impl<T: ?Sized> DerefMut for RefMut<'_, T> { #[inline] fn deref_mut(&mut self) -> &mut T { self.value @@ -1377,7 +1377,7 @@ impl<'b, T: ?Sized> DerefMut for RefMut<'b, T> { impl<'b, T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<RefMut<'b, U>> for RefMut<'b, T> {} #[stable(feature = "std_guard_impls", since = "1.20.0")] -impl<'a, T: ?Sized + fmt::Display> fmt::Display for RefMut<'a, T> { +impl<T: ?Sized + fmt::Display> fmt::Display for RefMut<'_, T> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { self.value.fmt(f) } diff --git a/src/libcore/clone.rs b/src/libcore/clone.rs index 3b15ba2b4ab..46bb580dcdd 100644 --- a/src/libcore/clone.rs +++ b/src/libcore/clone.rs @@ -204,7 +204,7 @@ mod impls { // Shared references can be cloned, but mutable references *cannot*! #[stable(feature = "rust1", since = "1.0.0")] - impl<'a, T: ?Sized> Clone for &'a T { + impl<T: ?Sized> Clone for &T { #[inline] fn clone(&self) -> Self { *self diff --git a/src/libcore/cmp.rs b/src/libcore/cmp.rs index ef7d83a0993..33881de3052 100644 --- a/src/libcore/cmp.rs +++ b/src/libcore/cmp.rs @@ -1033,12 +1033,12 @@ mod impls { fn gt(&self, other: & &'b B) -> bool { PartialOrd::gt(*self, *other) } } #[stable(feature = "rust1", since = "1.0.0")] - impl<'a, A: ?Sized> Ord for &'a A where A: Ord { + impl<A: ?Sized> Ord for &A where A: Ord { #[inline] - fn cmp(&self, other: & &'a A) -> Ordering { Ord::cmp(*self, *other) } + fn cmp(&self, other: &Self) -> Ordering { Ord::cmp(*self, *other) } } #[stable(feature = "rust1", since = "1.0.0")] - impl<'a, A: ?Sized> Eq for &'a A where A: Eq {} + impl<A: ?Sized> Eq for &A where A: Eq {} // &mut pointers @@ -1065,12 +1065,12 @@ mod impls { fn gt(&self, other: &&'b mut B) -> bool { PartialOrd::gt(*self, *other) } } #[stable(feature = "rust1", since = "1.0.0")] - impl<'a, A: ?Sized> Ord for &'a mut A where A: Ord { + impl<A: ?Sized> Ord for &mut A where A: Ord { #[inline] - fn cmp(&self, other: &&'a mut A) -> Ordering { Ord::cmp(*self, *other) } + fn cmp(&self, other: &Self) -> Ordering { Ord::cmp(*self, *other) } } #[stable(feature = "rust1", since = "1.0.0")] - impl<'a, A: ?Sized> Eq for &'a mut A where A: Eq {} + impl<A: ?Sized> Eq for &mut A where A: Eq {} #[stable(feature = "rust1", since = "1.0.0")] impl<'a, 'b, A: ?Sized, B: ?Sized> PartialEq<&'b mut B> for &'a A where A: PartialEq<B> { diff --git a/src/libcore/convert.rs b/src/libcore/convert.rs index d5337868843..b900990d0a7 100644 --- a/src/libcore/convert.rs +++ b/src/libcore/convert.rs @@ -407,7 +407,7 @@ pub trait TryFrom<T>: Sized { // As lifts over & #[stable(feature = "rust1", since = "1.0.0")] -impl<'a, T: ?Sized, U: ?Sized> AsRef<U> for &'a T where T: AsRef<U> +impl<T: ?Sized, U: ?Sized> AsRef<U> for &T where T: AsRef<U> { fn as_ref(&self) -> &U { <T as AsRef<U>>::as_ref(*self) @@ -416,7 +416,7 @@ impl<'a, T: ?Sized, U: ?Sized> AsRef<U> for &'a T where T: AsRef<U> // As lifts over &mut #[stable(feature = "rust1", since = "1.0.0")] -impl<'a, T: ?Sized, U: ?Sized> AsRef<U> for &'a mut T where T: AsRef<U> +impl<T: ?Sized, U: ?Sized> AsRef<U> for &mut T where T: AsRef<U> { fn as_ref(&self) -> &U { <T as AsRef<U>>::as_ref(*self) @@ -433,7 +433,7 @@ impl<'a, T: ?Sized, U: ?Sized> AsRef<U> for &'a mut T where T: AsRef<U> // AsMut lifts over &mut #[stable(feature = "rust1", since = "1.0.0")] -impl<'a, T: ?Sized, U: ?Sized> AsMut<U> for &'a mut T where T: AsMut<U> +impl<T: ?Sized, U: ?Sized> AsMut<U> for &mut T where T: AsMut<U> { fn as_mut(&mut self) -> &mut U { (*self).as_mut() diff --git a/src/libcore/fmt/builders.rs b/src/libcore/fmt/builders.rs index 3c5f934d4d8..4bc5b36d82b 100644 --- a/src/libcore/fmt/builders.rs +++ b/src/libcore/fmt/builders.rs @@ -28,7 +28,7 @@ impl<'a> PadAdapter<'a> { } } -impl<'a> fmt::Write for PadAdapter<'a> { +impl fmt::Write for PadAdapter<'_> { fn write_str(&mut self, mut s: &str) -> fmt::Result { while !s.is_empty() { if self.on_newline { diff --git a/src/libcore/fmt/mod.rs b/src/libcore/fmt/mod.rs index 7d131b5c99d..bd253e69db3 100644 --- a/src/libcore/fmt/mod.rs +++ b/src/libcore/fmt/mod.rs @@ -208,7 +208,7 @@ pub trait Write { // requiring a `Sized` bound. struct Adapter<'a,T: ?Sized +'a>(&'a mut T); - impl<'a, T: ?Sized> Write for Adapter<'a, T> + impl<T: ?Sized> Write for Adapter<'_, T> where T: Write { fn write_str(&mut self, s: &str) -> Result { @@ -229,7 +229,7 @@ pub trait Write { } #[stable(feature = "fmt_write_blanket_impl", since = "1.4.0")] -impl<'a, W: Write + ?Sized> Write for &'a mut W { +impl<W: Write + ?Sized> Write for &mut W { fn write_str(&mut self, s: &str) -> Result { (**self).write_str(s) } @@ -291,8 +291,8 @@ pub struct ArgumentV1<'a> { #[unstable(feature = "fmt_internals", reason = "internal to format_args!", issue = "0")] -impl<'a> Clone for ArgumentV1<'a> { - fn clone(&self) -> ArgumentV1<'a> { +impl Clone for ArgumentV1<'_> { + fn clone(&self) -> Self { *self } } @@ -436,14 +436,14 @@ pub struct Arguments<'a> { } #[stable(feature = "rust1", since = "1.0.0")] -impl<'a> Debug for Arguments<'a> { +impl Debug for Arguments<'_> { fn fmt(&self, fmt: &mut Formatter) -> Result { Display::fmt(self, fmt) } } #[stable(feature = "rust1", since = "1.0.0")] -impl<'a> Display for Arguments<'a> { +impl Display for Arguments<'_> { fn fmt(&self, fmt: &mut Formatter) -> Result { write(fmt.buf, *self) } @@ -1884,7 +1884,7 @@ impl<'a> Formatter<'a> { } #[stable(since = "1.2.0", feature = "formatter_write")] -impl<'a> Write for Formatter<'a> { +impl Write for Formatter<'_> { fn write_str(&mut self, s: &str) -> Result { self.buf.write_str(s) } @@ -1911,11 +1911,11 @@ macro_rules! fmt_refs { ($($tr:ident),*) => { $( #[stable(feature = "rust1", since = "1.0.0")] - impl<'a, T: ?Sized + $tr> $tr for &'a T { + impl<T: ?Sized + $tr> $tr for &T { fn fmt(&self, f: &mut Formatter) -> Result { $tr::fmt(&**self, f) } } #[stable(feature = "rust1", since = "1.0.0")] - impl<'a, T: ?Sized + $tr> $tr for &'a mut T { + impl<T: ?Sized + $tr> $tr for &mut T { fn fmt(&self, f: &mut Formatter) -> Result { $tr::fmt(&**self, f) } } )* @@ -2039,14 +2039,14 @@ impl<T: ?Sized> Pointer for *mut T { } #[stable(feature = "rust1", since = "1.0.0")] -impl<'a, T: ?Sized> Pointer for &'a T { +impl<T: ?Sized> Pointer for &T { fn fmt(&self, f: &mut Formatter) -> Result { Pointer::fmt(&(*self as *const T), f) } } #[stable(feature = "rust1", since = "1.0.0")] -impl<'a, T: ?Sized> Pointer for &'a mut T { +impl<T: ?Sized> Pointer for &mut T { fn fmt(&self, f: &mut Formatter) -> Result { Pointer::fmt(&(&**self as *const T), f) } @@ -2153,14 +2153,14 @@ impl<T: ?Sized + Debug> Debug for RefCell<T> { } #[stable(feature = "rust1", since = "1.0.0")] -impl<'b, T: ?Sized + Debug> Debug for Ref<'b, T> { +impl<T: ?Sized + Debug> Debug for Ref<'_, T> { fn fmt(&self, f: &mut Formatter) -> Result { Debug::fmt(&**self, f) } } #[stable(feature = "rust1", since = "1.0.0")] -impl<'b, T: ?Sized + Debug> Debug for RefMut<'b, T> { +impl<T: ?Sized + Debug> Debug for RefMut<'_, T> { fn fmt(&self, f: &mut Formatter) -> Result { Debug::fmt(&*(self.deref()), f) } diff --git a/src/libcore/hash/mod.rs b/src/libcore/hash/mod.rs index e7907e03444..bbebadd452a 100644 --- a/src/libcore/hash/mod.rs +++ b/src/libcore/hash/mod.rs @@ -361,7 +361,7 @@ pub trait Hasher { } #[stable(feature = "indirect_hasher_impl", since = "1.22.0")] -impl<'a, H: Hasher + ?Sized> Hasher for &'a mut H { +impl<H: Hasher + ?Sized> Hasher for &mut H { fn finish(&self) -> u64 { (**self).finish() } @@ -669,14 +669,14 @@ mod impls { #[stable(feature = "rust1", since = "1.0.0")] - impl<'a, T: ?Sized + Hash> Hash for &'a T { + impl<T: ?Sized + Hash> Hash for &T { fn hash<H: Hasher>(&self, state: &mut H) { (**self).hash(state); } } #[stable(feature = "rust1", since = "1.0.0")] - impl<'a, T: ?Sized + Hash> Hash for &'a mut T { + impl<T: ?Sized + Hash> Hash for &mut T { fn hash<H: Hasher>(&self, state: &mut H) { (**self).hash(state); } diff --git a/src/libcore/iter/iterator.rs b/src/libcore/iter/iterator.rs index d45c123d332..4ed4ddb5b65 100644 --- a/src/libcore/iter/iterator.rs +++ b/src/libcore/iter/iterator.rs @@ -2557,7 +2557,7 @@ fn select_fold1<I, B, FProj, FCmp>(mut it: I, } #[stable(feature = "rust1", since = "1.0.0")] -impl<'a, I: Iterator + ?Sized> Iterator for &'a mut I { +impl<I: Iterator + ?Sized> Iterator for &mut I { type Item = I::Item; fn next(&mut self) -> Option<I::Item> { (**self).next() } fn size_hint(&self) -> (usize, Option<usize>) { (**self).size_hint() } diff --git a/src/libcore/iter/traits.rs b/src/libcore/iter/traits.rs index 4b2c1aa551e..f95f8e7dbcb 100644 --- a/src/libcore/iter/traits.rs +++ b/src/libcore/iter/traits.rs @@ -724,7 +724,7 @@ pub trait ExactSizeIterator: Iterator { } #[stable(feature = "rust1", since = "1.0.0")] -impl<'a, I: ExactSizeIterator + ?Sized> ExactSizeIterator for &'a mut I { +impl<I: ExactSizeIterator + ?Sized> ExactSizeIterator for &mut I { fn len(&self) -> usize { (**self).len() } @@ -974,7 +974,7 @@ impl<T, U, E> Product<Result<U, E>> for Result<T, E> pub trait FusedIterator: Iterator {} #[stable(feature = "fused", since = "1.26.0")] -impl<'a, I: FusedIterator + ?Sized> FusedIterator for &'a mut I {} +impl<I: FusedIterator + ?Sized> FusedIterator for &mut I {} /// An iterator that reports an accurate length using size_hint. /// @@ -999,4 +999,4 @@ impl<'a, I: FusedIterator + ?Sized> FusedIterator for &'a mut I {} pub unsafe trait TrustedLen : Iterator {} #[unstable(feature = "trusted_len", issue = "37572")] -unsafe impl<'a, I: TrustedLen + ?Sized> TrustedLen for &'a mut I {} +unsafe impl<I: TrustedLen + ?Sized> TrustedLen for &mut I {} diff --git a/src/libcore/lib.rs b/src/libcore/lib.rs index 94e84106328..184ed19da95 100644 --- a/src/libcore/lib.rs +++ b/src/libcore/lib.rs @@ -87,6 +87,7 @@ #![feature(doc_spotlight)] #![feature(extern_types)] #![feature(fundamental)] +#![feature(impl_header_lifetime_elision)] #![feature(intrinsics)] #![feature(lang_items)] #![feature(link_llvm_intrinsics)] diff --git a/src/libcore/marker.rs b/src/libcore/marker.rs index 5572fe1512c..266c6913747 100644 --- a/src/libcore/marker.rs +++ b/src/libcore/marker.rs @@ -584,9 +584,9 @@ impls! { PhantomData } mod impls { #[stable(feature = "rust1", since = "1.0.0")] - unsafe impl<'a, T: Sync + ?Sized> Send for &'a T {} + unsafe impl<T: Sync + ?Sized> Send for &T {} #[stable(feature = "rust1", since = "1.0.0")] - unsafe impl<'a, T: Send + ?Sized> Send for &'a mut T {} + unsafe impl<T: Send + ?Sized> Send for &mut T {} } /// Compiler-internal trait used to determine whether a type contains @@ -600,8 +600,8 @@ impl<T: ?Sized> !Freeze for UnsafeCell<T> {} unsafe impl<T: ?Sized> Freeze for PhantomData<T> {} unsafe impl<T: ?Sized> Freeze for *const T {} unsafe impl<T: ?Sized> Freeze for *mut T {} -unsafe impl<'a, T: ?Sized> Freeze for &'a T {} -unsafe impl<'a, T: ?Sized> Freeze for &'a mut T {} +unsafe impl<T: ?Sized> Freeze for &T {} +unsafe impl<T: ?Sized> Freeze for &mut T {} /// Types which can be safely moved after being pinned. /// @@ -689,6 +689,6 @@ mod copy_impls { // Shared references can be copied, but mutable references *cannot*! #[stable(feature = "rust1", since = "1.0.0")] - impl<'a, T: ?Sized> Copy for &'a T {} + impl<T: ?Sized> Copy for &T {} } diff --git a/src/libcore/ops/deref.rs b/src/libcore/ops/deref.rs index 54eecc82e19..91a3d77e8b2 100644 --- a/src/libcore/ops/deref.rs +++ b/src/libcore/ops/deref.rs @@ -83,14 +83,14 @@ pub trait Deref { } #[stable(feature = "rust1", since = "1.0.0")] -impl<'a, T: ?Sized> Deref for &'a T { +impl<T: ?Sized> Deref for &T { type Target = T; fn deref(&self) -> &T { *self } } #[stable(feature = "rust1", since = "1.0.0")] -impl<'a, T: ?Sized> Deref for &'a mut T { +impl<T: ?Sized> Deref for &mut T { type Target = T; fn deref(&self) -> &T { *self } @@ -174,6 +174,6 @@ pub trait DerefMut: Deref { } #[stable(feature = "rust1", since = "1.0.0")] -impl<'a, T: ?Sized> DerefMut for &'a mut T { +impl<T: ?Sized> DerefMut for &mut T { fn deref_mut(&mut self) -> &mut T { *self } } diff --git a/src/libcore/ops/function.rs b/src/libcore/ops/function.rs index 3ebd10a9209..c9591c3f57b 100644 --- a/src/libcore/ops/function.rs +++ b/src/libcore/ops/function.rs @@ -240,7 +240,7 @@ pub trait FnOnce<Args> { mod impls { #[stable(feature = "rust1", since = "1.0.0")] - impl<'a,A,F:?Sized> Fn<A> for &'a F + impl<A,F:?Sized> Fn<A> for &F where F : Fn<A> { extern "rust-call" fn call(&self, args: A) -> F::Output { @@ -249,7 +249,7 @@ mod impls { } #[stable(feature = "rust1", since = "1.0.0")] - impl<'a,A,F:?Sized> FnMut<A> for &'a F + impl<A,F:?Sized> FnMut<A> for &F where F : Fn<A> { extern "rust-call" fn call_mut(&mut self, args: A) -> F::Output { @@ -258,7 +258,7 @@ mod impls { } #[stable(feature = "rust1", since = "1.0.0")] - impl<'a,A,F:?Sized> FnOnce<A> for &'a F + impl<A,F:?Sized> FnOnce<A> for &F where F : Fn<A> { type Output = F::Output; @@ -269,7 +269,7 @@ mod impls { } #[stable(feature = "rust1", since = "1.0.0")] - impl<'a,A,F:?Sized> FnMut<A> for &'a mut F + impl<A,F:?Sized> FnMut<A> for &mut F where F : FnMut<A> { extern "rust-call" fn call_mut(&mut self, args: A) -> F::Output { @@ -278,7 +278,7 @@ mod impls { } #[stable(feature = "rust1", since = "1.0.0")] - impl<'a,A,F:?Sized> FnOnce<A> for &'a mut F + impl<A,F:?Sized> FnOnce<A> for &mut F where F : FnMut<A> { type Output = F::Output; diff --git a/src/libcore/ops/generator.rs b/src/libcore/ops/generator.rs index 4b70c5398be..297089926b5 100644 --- a/src/libcore/ops/generator.rs +++ b/src/libcore/ops/generator.rs @@ -124,7 +124,7 @@ pub trait Generator { } #[unstable(feature = "generator_trait", issue = "43122")] -impl<'a, T> Generator for &'a mut T +impl<T> Generator for &mut T where T: Generator + ?Sized { type Yield = T::Yield; diff --git a/src/libcore/ops/range.rs b/src/libcore/ops/range.rs index 9c635678d7a..f7e5a89a7aa 100644 --- a/src/libcore/ops/range.rs +++ b/src/libcore/ops/range.rs @@ -851,7 +851,7 @@ impl<'a, T: ?Sized + 'a> RangeBounds<T> for (Bound<&'a T>, Bound<&'a T>) { } #[stable(feature = "collections_range", since = "1.28.0")] -impl<'a, T> RangeBounds<T> for RangeFrom<&'a T> { +impl<T> RangeBounds<T> for RangeFrom<&T> { fn start_bound(&self) -> Bound<&T> { Included(self.start) } @@ -861,7 +861,7 @@ impl<'a, T> RangeBounds<T> for RangeFrom<&'a T> { } #[stable(feature = "collections_range", since = "1.28.0")] -impl<'a, T> RangeBounds<T> for RangeTo<&'a T> { +impl<T> RangeBounds<T> for RangeTo<&T> { fn start_bound(&self) -> Bound<&T> { Unbounded } @@ -871,7 +871,7 @@ impl<'a, T> RangeBounds<T> for RangeTo<&'a T> { } #[stable(feature = "collections_range", since = "1.28.0")] -impl<'a, T> RangeBounds<T> for Range<&'a T> { +impl<T> RangeBounds<T> for Range<&T> { fn start_bound(&self) -> Bound<&T> { Included(self.start) } @@ -881,7 +881,7 @@ impl<'a, T> RangeBounds<T> for Range<&'a T> { } #[stable(feature = "collections_range", since = "1.28.0")] -impl<'a, T> RangeBounds<T> for RangeInclusive<&'a T> { +impl<T> RangeBounds<T> for RangeInclusive<&T> { fn start_bound(&self) -> Bound<&T> { Included(self.start) } @@ -891,7 +891,7 @@ impl<'a, T> RangeBounds<T> for RangeInclusive<&'a T> { } #[stable(feature = "collections_range", since = "1.28.0")] -impl<'a, T> RangeBounds<T> for RangeToInclusive<&'a T> { +impl<T> RangeBounds<T> for RangeToInclusive<&T> { fn start_bound(&self) -> Bound<&T> { Unbounded } diff --git a/src/libcore/option.rs b/src/libcore/option.rs index 58bf6be834d..0255f7a0885 100644 --- a/src/libcore/option.rs +++ b/src/libcore/option.rs @@ -1153,18 +1153,18 @@ impl<'a, A> DoubleEndedIterator for Iter<'a, A> { } #[stable(feature = "rust1", since = "1.0.0")] -impl<'a, A> ExactSizeIterator for Iter<'a, A> {} +impl<A> ExactSizeIterator for Iter<'_, A> {} #[stable(feature = "fused", since = "1.26.0")] -impl<'a, A> FusedIterator for Iter<'a, A> {} +impl<A> FusedIterator for Iter<'_, A> {} #[unstable(feature = "trusted_len", issue = "37572")] -unsafe impl<'a, A> TrustedLen for Iter<'a, A> {} +unsafe impl<A> TrustedLen for Iter<'_, A> {} #[stable(feature = "rust1", since = "1.0.0")] -impl<'a, A> Clone for Iter<'a, A> { +impl<A> Clone for Iter<'_, A> { #[inline] - fn clone(&self) -> Iter<'a, A> { + fn clone(&self) -> Self { Iter { inner: self.inner.clone() } } } @@ -1199,12 +1199,12 @@ impl<'a, A> DoubleEndedIterator for IterMut<'a, A> { } #[stable(feature = "rust1", since = "1.0.0")] -impl<'a, A> ExactSizeIterator for IterMut<'a, A> {} +impl<A> ExactSizeIterator for IterMut<'_, A> {} #[stable(feature = "fused", since = "1.26.0")] -impl<'a, A> FusedIterator for IterMut<'a, A> {} +impl<A> FusedIterator for IterMut<'_, A> {} #[unstable(feature = "trusted_len", issue = "37572")] -unsafe impl<'a, A> TrustedLen for IterMut<'a, A> {} +unsafe impl<A> TrustedLen for IterMut<'_, A> {} /// An iterator over the value in [`Some`] variant of an [`Option`]. /// diff --git a/src/libcore/panic.rs b/src/libcore/panic.rs index 17cac5aa0a0..f0efeb59e8d 100644 --- a/src/libcore/panic.rs +++ b/src/libcore/panic.rs @@ -133,7 +133,7 @@ impl<'a> PanicInfo<'a> { } #[stable(feature = "panic_hook_display", since = "1.26.0")] -impl<'a> fmt::Display for PanicInfo<'a> { +impl fmt::Display for PanicInfo<'_> { fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { formatter.write_str("panicked at ")?; if let Some(message) = self.message { @@ -258,7 +258,7 @@ impl<'a> Location<'a> { } #[stable(feature = "panic_hook_display", since = "1.26.0")] -impl<'a> fmt::Display for Location<'a> { +impl fmt::Display for Location<'_> { fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { write!(formatter, "{}:{}:{}", self.file, self.line, self.col) } diff --git a/src/libcore/result.rs b/src/libcore/result.rs index 93ee11aac36..3484664c242 100644 --- a/src/libcore/result.rs +++ b/src/libcore/result.rs @@ -1098,18 +1098,18 @@ impl<'a, T> DoubleEndedIterator for Iter<'a, T> { } #[stable(feature = "rust1", since = "1.0.0")] -impl<'a, T> ExactSizeIterator for Iter<'a, T> {} +impl<T> ExactSizeIterator for Iter<'_, T> {} #[stable(feature = "fused", since = "1.26.0")] -impl<'a, T> FusedIterator for Iter<'a, T> {} +impl<T> FusedIterator for Iter<'_, T> {} #[unstable(feature = "trusted_len", issue = "37572")] -unsafe impl<'a, A> TrustedLen for Iter<'a, A> {} +unsafe impl<A> TrustedLen for Iter<'_, A> {} #[stable(feature = "rust1", since = "1.0.0")] -impl<'a, T> Clone for Iter<'a, T> { +impl<T> Clone for Iter<'_, T> { #[inline] - fn clone(&self) -> Iter<'a, T> { Iter { inner: self.inner } } + fn clone(&self) -> Self { Iter { inner: self.inner } } } /// An iterator over a mutable reference to the [`Ok`] variant of a [`Result`]. @@ -1143,13 +1143,13 @@ impl<'a, T> DoubleEndedIterator for IterMut<'a, T> { } #[stable(feature = "rust1", since = "1.0.0")] -impl<'a, T> ExactSizeIterator for IterMut<'a, T> {} +impl<T> ExactSizeIterator for IterMut<'_, T> {} #[stable(feature = "fused", since = "1.26.0")] -impl<'a, T> FusedIterator for IterMut<'a, T> {} +impl<T> FusedIterator for IterMut<'_, T> {} #[unstable(feature = "trusted_len", issue = "37572")] -unsafe impl<'a, A> TrustedLen for IterMut<'a, A> {} +unsafe impl<A> TrustedLen for IterMut<'_, A> {} /// An iterator over the value in a [`Ok`] variant of a [`Result`]. /// diff --git a/src/libcore/slice/mod.rs b/src/libcore/slice/mod.rs index d400bd49050..a50426ba886 100644 --- a/src/libcore/slice/mod.rs +++ b/src/libcore/slice/mod.rs @@ -2529,15 +2529,15 @@ impl<T> SliceIndex<[T]> for ops::RangeToInclusive<usize> { //////////////////////////////////////////////////////////////////////////////// #[stable(feature = "rust1", since = "1.0.0")] -impl<'a, T> Default for &'a [T] { +impl<T> Default for &[T] { /// Creates an empty slice. - fn default() -> &'a [T] { &[] } + fn default() -> Self { &[] } } #[stable(feature = "mut_slice_default", since = "1.5.0")] -impl<'a, T> Default for &'a mut [T] { +impl<T> Default for &mut [T] { /// Creates a mutable empty slice. - fn default() -> &'a mut [T] { &mut [] } + fn default() -> Self { &mut [] } } // @@ -2864,7 +2864,7 @@ pub struct Iter<'a, T: 'a> { } #[stable(feature = "core_impl_debug", since = "1.9.0")] -impl<'a, T: 'a + fmt::Debug> fmt::Debug for Iter<'a, T> { +impl<T: fmt::Debug> fmt::Debug for Iter<'_, T> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_tuple("Iter") .field(&self.as_slice()) @@ -2873,9 +2873,9 @@ impl<'a, T: 'a + fmt::Debug> fmt::Debug for Iter<'a, T> { } #[stable(feature = "rust1", since = "1.0.0")] -unsafe impl<'a, T: Sync> Sync for Iter<'a, T> {} +unsafe impl<T: Sync> Sync for Iter<'_, T> {} #[stable(feature = "rust1", since = "1.0.0")] -unsafe impl<'a, T: Sync> Send for Iter<'a, T> {} +unsafe impl<T: Sync> Send for Iter<'_, T> {} impl<'a, T> Iter<'a, T> { /// View the underlying data as a subslice of the original data. @@ -2911,12 +2911,12 @@ impl<'a, T> Iter<'a, T> { iterator!{struct Iter -> *const T, &'a T, const, /* no mut */} #[stable(feature = "rust1", since = "1.0.0")] -impl<'a, T> Clone for Iter<'a, T> { - fn clone(&self) -> Iter<'a, T> { Iter { ptr: self.ptr, end: self.end, _marker: self._marker } } +impl<T> Clone for Iter<'_, T> { + fn clone(&self) -> Self { Iter { ptr: self.ptr, end: self.end, _marker: self._marker } } } #[stable(feature = "slice_iter_as_ref", since = "1.13.0")] -impl<'a, T> AsRef<[T]> for Iter<'a, T> { +impl<T> AsRef<[T]> for Iter<'_, T> { fn as_ref(&self) -> &[T] { self.as_slice() } @@ -2956,7 +2956,7 @@ pub struct IterMut<'a, T: 'a> { } #[stable(feature = "core_impl_debug", since = "1.9.0")] -impl<'a, T: 'a + fmt::Debug> fmt::Debug for IterMut<'a, T> { +impl<T: fmt::Debug> fmt::Debug for IterMut<'_, T> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_tuple("IterMut") .field(&self.make_slice()) @@ -2965,9 +2965,9 @@ impl<'a, T: 'a + fmt::Debug> fmt::Debug for IterMut<'a, T> { } #[stable(feature = "rust1", since = "1.0.0")] -unsafe impl<'a, T: Sync> Sync for IterMut<'a, T> {} +unsafe impl<T: Sync> Sync for IterMut<'_, T> {} #[stable(feature = "rust1", since = "1.0.0")] -unsafe impl<'a, T: Send> Send for IterMut<'a, T> {} +unsafe impl<T: Send> Send for IterMut<'_, T> {} impl<'a, T> IterMut<'a, T> { /// View the underlying data as a subslice of the original data. @@ -3035,7 +3035,7 @@ pub struct Split<'a, T:'a, P> where P: FnMut(&T) -> bool { } #[stable(feature = "core_impl_debug", since = "1.9.0")] -impl<'a, T: 'a + fmt::Debug, P> fmt::Debug for Split<'a, T, P> where P: FnMut(&T) -> bool { +impl<T: fmt::Debug, P> fmt::Debug for Split<'_, T, P> where P: FnMut(&T) -> bool { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("Split") .field("v", &self.v) @@ -3046,8 +3046,8 @@ impl<'a, T: 'a + fmt::Debug, P> fmt::Debug for Split<'a, T, P> where P: FnMut(&T // FIXME(#26925) Remove in favor of `#[derive(Clone)]` #[stable(feature = "rust1", since = "1.0.0")] -impl<'a, T, P> Clone for Split<'a, T, P> where P: Clone + FnMut(&T) -> bool { - fn clone(&self) -> Split<'a, T, P> { +impl<T, P> Clone for Split<'_, T, P> where P: Clone + FnMut(&T) -> bool { + fn clone(&self) -> Self { Split { v: self.v, pred: self.pred.clone(), @@ -3109,7 +3109,7 @@ impl<'a, T, P> SplitIter for Split<'a, T, P> where P: FnMut(&T) -> bool { } #[stable(feature = "fused", since = "1.26.0")] -impl<'a, T, P> FusedIterator for Split<'a, T, P> where P: FnMut(&T) -> bool {} +impl<T, P> FusedIterator for Split<'_, T, P> where P: FnMut(&T) -> bool {} /// An iterator over the subslices of the vector which are separated /// by elements that match `pred`. @@ -3126,7 +3126,7 @@ pub struct SplitMut<'a, T:'a, P> where P: FnMut(&T) -> bool { } #[stable(feature = "core_impl_debug", since = "1.9.0")] -impl<'a, T: 'a + fmt::Debug, P> fmt::Debug for SplitMut<'a, T, P> where P: FnMut(&T) -> bool { +impl<T: fmt::Debug, P> fmt::Debug for SplitMut<'_, T, P> where P: FnMut(&T) -> bool { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("SplitMut") .field("v", &self.v) @@ -3207,7 +3207,7 @@ impl<'a, T, P> DoubleEndedIterator for SplitMut<'a, T, P> where } #[stable(feature = "fused", since = "1.26.0")] -impl<'a, T, P> FusedIterator for SplitMut<'a, T, P> where P: FnMut(&T) -> bool {} +impl<T, P> FusedIterator for SplitMut<'_, T, P> where P: FnMut(&T) -> bool {} /// An iterator over subslices separated by elements that match a predicate /// function, starting from the end of the slice. @@ -3223,7 +3223,7 @@ pub struct RSplit<'a, T:'a, P> where P: FnMut(&T) -> bool { } #[stable(feature = "slice_rsplit", since = "1.27.0")] -impl<'a, T: 'a + fmt::Debug, P> fmt::Debug for RSplit<'a, T, P> where P: FnMut(&T) -> bool { +impl<T: fmt::Debug, P> fmt::Debug for RSplit<'_, T, P> where P: FnMut(&T) -> bool { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("RSplit") .field("v", &self.inner.v) @@ -3264,7 +3264,7 @@ impl<'a, T, P> SplitIter for RSplit<'a, T, P> where P: FnMut(&T) -> bool { } #[stable(feature = "slice_rsplit", since = "1.27.0")] -impl<'a, T, P> FusedIterator for RSplit<'a, T, P> where P: FnMut(&T) -> bool {} +impl<T, P> FusedIterator for RSplit<'_, T, P> where P: FnMut(&T) -> bool {} /// An iterator over the subslices of the vector which are separated /// by elements that match `pred`, starting from the end of the slice. @@ -3279,7 +3279,7 @@ pub struct RSplitMut<'a, T:'a, P> where P: FnMut(&T) -> bool { } #[stable(feature = "slice_rsplit", since = "1.27.0")] -impl<'a, T: 'a + fmt::Debug, P> fmt::Debug for RSplitMut<'a, T, P> where P: FnMut(&T) -> bool { +impl<T: fmt::Debug, P> fmt::Debug for RSplitMut<'_, T, P> where P: FnMut(&T) -> bool { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("RSplitMut") .field("v", &self.inner.v) @@ -3322,7 +3322,7 @@ impl<'a, T, P> DoubleEndedIterator for RSplitMut<'a, T, P> where } #[stable(feature = "slice_rsplit", since = "1.27.0")] -impl<'a, T, P> FusedIterator for RSplitMut<'a, T, P> where P: FnMut(&T) -> bool {} +impl<T, P> FusedIterator for RSplitMut<'_, T, P> where P: FnMut(&T) -> bool {} /// An private iterator over subslices separated by elements that /// match a predicate function, splitting at most a fixed number of @@ -3365,7 +3365,7 @@ pub struct SplitN<'a, T: 'a, P> where P: FnMut(&T) -> bool { } #[stable(feature = "core_impl_debug", since = "1.9.0")] -impl<'a, T: 'a + fmt::Debug, P> fmt::Debug for SplitN<'a, T, P> where P: FnMut(&T) -> bool { +impl<T: fmt::Debug, P> fmt::Debug for SplitN<'_, T, P> where P: FnMut(&T) -> bool { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("SplitN") .field("inner", &self.inner) @@ -3387,7 +3387,7 @@ pub struct RSplitN<'a, T: 'a, P> where P: FnMut(&T) -> bool { } #[stable(feature = "core_impl_debug", since = "1.9.0")] -impl<'a, T: 'a + fmt::Debug, P> fmt::Debug for RSplitN<'a, T, P> where P: FnMut(&T) -> bool { +impl<T: fmt::Debug, P> fmt::Debug for RSplitN<'_, T, P> where P: FnMut(&T) -> bool { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("RSplitN") .field("inner", &self.inner) @@ -3408,7 +3408,7 @@ pub struct SplitNMut<'a, T: 'a, P> where P: FnMut(&T) -> bool { } #[stable(feature = "core_impl_debug", since = "1.9.0")] -impl<'a, T: 'a + fmt::Debug, P> fmt::Debug for SplitNMut<'a, T, P> where P: FnMut(&T) -> bool { +impl<T: fmt::Debug, P> fmt::Debug for SplitNMut<'_, T, P> where P: FnMut(&T) -> bool { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("SplitNMut") .field("inner", &self.inner) @@ -3430,7 +3430,7 @@ pub struct RSplitNMut<'a, T: 'a, P> where P: FnMut(&T) -> bool { } #[stable(feature = "core_impl_debug", since = "1.9.0")] -impl<'a, T: 'a + fmt::Debug, P> fmt::Debug for RSplitNMut<'a, T, P> where P: FnMut(&T) -> bool { +impl<T: fmt::Debug, P> fmt::Debug for RSplitNMut<'_, T, P> where P: FnMut(&T) -> bool { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("RSplitNMut") .field("inner", &self.inner) @@ -3483,8 +3483,8 @@ pub struct Windows<'a, T:'a> { // FIXME(#26925) Remove in favor of `#[derive(Clone)]` #[stable(feature = "rust1", since = "1.0.0")] -impl<'a, T> Clone for Windows<'a, T> { - fn clone(&self) -> Windows<'a, T> { +impl<T> Clone for Windows<'_, T> { + fn clone(&self) -> Self { Windows { v: self.v, size: self.size, @@ -3561,13 +3561,13 @@ impl<'a, T> DoubleEndedIterator for Windows<'a, T> { } #[stable(feature = "rust1", since = "1.0.0")] -impl<'a, T> ExactSizeIterator for Windows<'a, T> {} +impl<T> ExactSizeIterator for Windows<'_, T> {} #[unstable(feature = "trusted_len", issue = "37572")] -unsafe impl<'a, T> TrustedLen for Windows<'a, T> {} +unsafe impl<T> TrustedLen for Windows<'_, T> {} #[stable(feature = "fused", since = "1.26.0")] -impl<'a, T> FusedIterator for Windows<'a, T> {} +impl<T> FusedIterator for Windows<'_, T> {} #[doc(hidden)] unsafe impl<'a, T> TrustedRandomAccess for Windows<'a, T> { @@ -3596,8 +3596,8 @@ pub struct Chunks<'a, T:'a> { // FIXME(#26925) Remove in favor of `#[derive(Clone)]` #[stable(feature = "rust1", since = "1.0.0")] -impl<'a, T> Clone for Chunks<'a, T> { - fn clone(&self) -> Chunks<'a, T> { +impl<T> Clone for Chunks<'_, T> { + fn clone(&self) -> Self { Chunks { v: self.v, chunk_size: self.chunk_size, @@ -3683,13 +3683,13 @@ impl<'a, T> DoubleEndedIterator for Chunks<'a, T> { } #[stable(feature = "rust1", since = "1.0.0")] -impl<'a, T> ExactSizeIterator for Chunks<'a, T> {} +impl<T> ExactSizeIterator for Chunks<'_, T> {} #[unstable(feature = "trusted_len", issue = "37572")] -unsafe impl<'a, T> TrustedLen for Chunks<'a, T> {} +unsafe impl<T> TrustedLen for Chunks<'_, T> {} #[stable(feature = "fused", since = "1.26.0")] -impl<'a, T> FusedIterator for Chunks<'a, T> {} +impl<T> FusedIterator for Chunks<'_, T> {} #[doc(hidden)] unsafe impl<'a, T> TrustedRandomAccess for Chunks<'a, T> { @@ -3802,13 +3802,13 @@ impl<'a, T> DoubleEndedIterator for ChunksMut<'a, T> { } #[stable(feature = "rust1", since = "1.0.0")] -impl<'a, T> ExactSizeIterator for ChunksMut<'a, T> {} +impl<T> ExactSizeIterator for ChunksMut<'_, T> {} #[unstable(feature = "trusted_len", issue = "37572")] -unsafe impl<'a, T> TrustedLen for ChunksMut<'a, T> {} +unsafe impl<T> TrustedLen for ChunksMut<'_, T> {} #[stable(feature = "fused", since = "1.26.0")] -impl<'a, T> FusedIterator for ChunksMut<'a, T> {} +impl<T> FusedIterator for ChunksMut<'_, T> {} #[doc(hidden)] unsafe impl<'a, T> TrustedRandomAccess for ChunksMut<'a, T> { @@ -3855,8 +3855,8 @@ impl<'a, T> ChunksExact<'a, T> { // FIXME(#26925) Remove in favor of `#[derive(Clone)]` #[unstable(feature = "chunks_exact", issue = "47115")] -impl<'a, T> Clone for ChunksExact<'a, T> { - fn clone(&self) -> ChunksExact<'a, T> { +impl<T> Clone for ChunksExact<'_, T> { + fn clone(&self) -> Self { ChunksExact { v: self.v, rem: self.rem, @@ -3925,17 +3925,17 @@ impl<'a, T> DoubleEndedIterator for ChunksExact<'a, T> { } #[unstable(feature = "chunks_exact", issue = "47115")] -impl<'a, T> ExactSizeIterator for ChunksExact<'a, T> { +impl<T> ExactSizeIterator for ChunksExact<'_, T> { fn is_empty(&self) -> bool { self.v.is_empty() } } #[unstable(feature = "trusted_len", issue = "37572")] -unsafe impl<'a, T> TrustedLen for ChunksExact<'a, T> {} +unsafe impl<T> TrustedLen for ChunksExact<'_, T> {} #[unstable(feature = "chunks_exact", issue = "47115")] -impl<'a, T> FusedIterator for ChunksExact<'a, T> {} +impl<T> FusedIterator for ChunksExact<'_, T> {} #[doc(hidden)] unsafe impl<'a, T> TrustedRandomAccess for ChunksExact<'a, T> { @@ -4040,17 +4040,17 @@ impl<'a, T> DoubleEndedIterator for ChunksExactMut<'a, T> { } #[unstable(feature = "chunks_exact", issue = "47115")] -impl<'a, T> ExactSizeIterator for ChunksExactMut<'a, T> { +impl<T> ExactSizeIterator for ChunksExactMut<'_, T> { fn is_empty(&self) -> bool { self.v.is_empty() } } #[unstable(feature = "trusted_len", issue = "37572")] -unsafe impl<'a, T> TrustedLen for ChunksExactMut<'a, T> {} +unsafe impl<T> TrustedLen for ChunksExactMut<'_, T> {} #[unstable(feature = "chunks_exact", issue = "47115")] -impl<'a, T> FusedIterator for ChunksExactMut<'a, T> {} +impl<T> FusedIterator for ChunksExactMut<'_, T> {} #[doc(hidden)] unsafe impl<'a, T> TrustedRandomAccess for ChunksExactMut<'a, T> { diff --git a/src/libcore/str/mod.rs b/src/libcore/str/mod.rs index 2c941c28d4b..a2782dd8e2e 100644 --- a/src/libcore/str/mod.rs +++ b/src/libcore/str/mod.rs @@ -617,7 +617,7 @@ impl<'a> DoubleEndedIterator for Chars<'a> { } #[stable(feature = "fused", since = "1.26.0")] -impl<'a> FusedIterator for Chars<'a> {} +impl FusedIterator for Chars<'_> {} impl<'a> Chars<'a> { /// View the underlying data as a subslice of the original data. @@ -707,7 +707,7 @@ impl<'a> DoubleEndedIterator for CharIndices<'a> { } #[stable(feature = "fused", since = "1.26.0")] -impl<'a> FusedIterator for CharIndices<'a> {} +impl FusedIterator for CharIndices<'_> {} impl<'a> CharIndices<'a> { /// View the underlying data as a subslice of the original data. @@ -733,7 +733,7 @@ impl<'a> CharIndices<'a> { pub struct Bytes<'a>(Cloned<slice::Iter<'a, u8>>); #[stable(feature = "rust1", since = "1.0.0")] -impl<'a> Iterator for Bytes<'a> { +impl Iterator for Bytes<'_> { type Item = u8; #[inline] @@ -794,7 +794,7 @@ impl<'a> Iterator for Bytes<'a> { } #[stable(feature = "rust1", since = "1.0.0")] -impl<'a> DoubleEndedIterator for Bytes<'a> { +impl DoubleEndedIterator for Bytes<'_> { #[inline] fn next_back(&mut self) -> Option<u8> { self.0.next_back() @@ -809,7 +809,7 @@ impl<'a> DoubleEndedIterator for Bytes<'a> { } #[stable(feature = "rust1", since = "1.0.0")] -impl<'a> ExactSizeIterator for Bytes<'a> { +impl ExactSizeIterator for Bytes<'_> { #[inline] fn len(&self) -> usize { self.0.len() @@ -822,10 +822,10 @@ impl<'a> ExactSizeIterator for Bytes<'a> { } #[stable(feature = "fused", since = "1.26.0")] -impl<'a> FusedIterator for Bytes<'a> {} +impl FusedIterator for Bytes<'_> {} #[unstable(feature = "trusted_len", issue = "37572")] -unsafe impl<'a> TrustedLen for Bytes<'a> {} +unsafe impl TrustedLen for Bytes<'_> {} #[doc(hidden)] unsafe impl<'a> TrustedRandomAccess for Bytes<'a> { @@ -1342,7 +1342,7 @@ impl<'a> DoubleEndedIterator for Lines<'a> { } #[stable(feature = "fused", since = "1.26.0")] -impl<'a> FusedIterator for Lines<'a> {} +impl FusedIterator for Lines<'_> {} /// Created with the method [`lines_any`]. /// @@ -1409,7 +1409,7 @@ impl<'a> DoubleEndedIterator for LinesAny<'a> { #[stable(feature = "fused", since = "1.26.0")] #[allow(deprecated)] -impl<'a> FusedIterator for LinesAny<'a> {} +impl FusedIterator for LinesAny<'_> {} /* Section: UTF-8 validation @@ -4033,15 +4033,15 @@ impl AsRef<[u8]> for str { } #[stable(feature = "rust1", since = "1.0.0")] -impl<'a> Default for &'a str { +impl Default for &str { /// Creates an empty str - fn default() -> &'a str { "" } + fn default() -> Self { "" } } #[stable(feature = "default_mut_str", since = "1.28.0")] -impl<'a> Default for &'a mut str { +impl Default for &mut str { /// Creates an empty mutable str - fn default() -> &'a mut str { unsafe { from_utf8_unchecked_mut(&mut []) } } + fn default() -> Self { unsafe { from_utf8_unchecked_mut(&mut []) } } } /// An iterator over the non-whitespace substrings of a string, @@ -4189,7 +4189,7 @@ impl<'a> DoubleEndedIterator for SplitWhitespace<'a> { } #[stable(feature = "fused", since = "1.26.0")] -impl<'a> FusedIterator for SplitWhitespace<'a> {} +impl FusedIterator for SplitWhitespace<'_> {} #[unstable(feature = "split_ascii_whitespace", issue = "48656")] impl<'a> Iterator for SplitAsciiWhitespace<'a> { @@ -4215,7 +4215,7 @@ impl<'a> DoubleEndedIterator for SplitAsciiWhitespace<'a> { } #[unstable(feature = "split_ascii_whitespace", issue = "48656")] -impl<'a> FusedIterator for SplitAsciiWhitespace<'a> {} +impl FusedIterator for SplitAsciiWhitespace<'_> {} /// An iterator of [`u16`] over the string encoded as UTF-16. /// @@ -4234,7 +4234,7 @@ pub struct EncodeUtf16<'a> { } #[stable(feature = "collection_debug", since = "1.17.0")] -impl<'a> fmt::Debug for EncodeUtf16<'a> { +impl fmt::Debug for EncodeUtf16<'_> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.pad("EncodeUtf16 { .. }") } @@ -4273,4 +4273,4 @@ impl<'a> Iterator for EncodeUtf16<'a> { } #[stable(feature = "fused", since = "1.26.0")] -impl<'a> FusedIterator for EncodeUtf16<'a> {} +impl FusedIterator for EncodeUtf16<'_> {} diff --git a/src/libcore/str/pattern.rs b/src/libcore/str/pattern.rs index 5e63fa9ff35..1c974533e10 100644 --- a/src/libcore/str/pattern.rs +++ b/src/libcore/str/pattern.rs @@ -491,7 +491,7 @@ impl<F> MultiCharEq for F where F: FnMut(char) -> bool { fn matches(&mut self, c: char) -> bool { (*self)(c) } } -impl<'a> MultiCharEq for &'a [char] { +impl MultiCharEq for &[char] { #[inline] fn matches(&mut self, c: char) -> bool { self.iter().any(|&m| { m == c }) @@ -666,7 +666,7 @@ impl<'a, 'b> Pattern<'a> for &'b [char] { pub struct CharPredicateSearcher<'a, F>(<MultiCharEqPattern<F> as Pattern<'a>>::Searcher) where F: FnMut(char) -> bool; -impl<'a, F> fmt::Debug for CharPredicateSearcher<'a, F> +impl<F> fmt::Debug for CharPredicateSearcher<'_, F> where F: FnMut(char) -> bool { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { diff --git a/src/libcore/tests/iter.rs b/src/libcore/tests/iter.rs index 72b115f8b5f..2476c07cbd9 100644 --- a/src/libcore/tests/iter.rs +++ b/src/libcore/tests/iter.rs @@ -229,7 +229,7 @@ fn test_iterator_step_by_nth_overflow() { #[derive(Clone)] struct Test(Bigger); - impl<'a> Iterator for &'a mut Test { + impl Iterator for &mut Test { type Item = i32; fn next(&mut self) -> Option<Self::Item> { Some(21) } fn nth(&mut self, n: usize) -> Option<Self::Item> { diff --git a/src/libcore/tests/lib.rs b/src/libcore/tests/lib.rs index e034ff80593..ada61d8dfd8 100644 --- a/src/libcore/tests/lib.rs +++ b/src/libcore/tests/lib.rs @@ -19,6 +19,7 @@ #![feature(flt2dec)] #![feature(fmt_internals)] #![feature(hashmap_internals)] +#![feature(impl_header_lifetime_elision)] #![feature(pattern)] #![feature(range_is_empty)] #![feature(raw)] |
