diff options
| author | Scott McMurray <scottmcm@users.noreply.github.com> | 2019-02-17 19:42:36 -0800 |
|---|---|---|
| committer | Scott McMurray <scottmcm@users.noreply.github.com> | 2019-02-17 19:42:36 -0800 |
| commit | 3bea2ca49d24606920b3a81811379debc0668992 (patch) | |
| tree | 5e8cc79e957d9158bcdd1a26e848b7fbc7b24f97 /src/libstd/net | |
| parent | 16ca0b9f6335db824e44629be1cafb6e3fcc4628 (diff) | |
| download | rust-3bea2ca49d24606920b3a81811379debc0668992.tar.gz rust-3bea2ca49d24606920b3a81811379debc0668992.zip | |
Use more impl header lifetime elision
There are two big categories of changes in here - Removing lifetimes from common traits that can essentially never user a lifetime from an input (particularly `Drop` & `Debug`) - Forwarding impls that are only possible because the lifetime doesn't matter (like `impl<R: Read + ?Sized> Read for &mut R`) I omitted things that seemed like they could be more controversial, like the handful of iterators that have a `Item: 'static` despite the iterator having a lifetime or the `PartialEq` implementations where the flipped one cannot elide the lifetime.
Diffstat (limited to 'src/libstd/net')
| -rw-r--r-- | src/libstd/net/addr.rs | 4 | ||||
| -rw-r--r-- | src/libstd/net/tcp.rs | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/src/libstd/net/addr.rs b/src/libstd/net/addr.rs index 8ace1127658..f9f89468a49 100644 --- a/src/libstd/net/addr.rs +++ b/src/libstd/net/addr.rs @@ -861,7 +861,7 @@ fn resolve_socket_addr(lh: LookupHost) -> io::Result<vec::IntoIter<SocketAddr>> } #[stable(feature = "rust1", since = "1.0.0")] -impl<'a> ToSocketAddrs for (&'a str, u16) { +impl ToSocketAddrs for (&str, u16) { type Iter = vec::IntoIter<SocketAddr>; fn to_socket_addrs(&self) -> io::Result<vec::IntoIter<SocketAddr>> { let (host, port) = *self; @@ -904,7 +904,7 @@ impl<'a> ToSocketAddrs for &'a [SocketAddr] { } #[stable(feature = "rust1", since = "1.0.0")] -impl<'a, T: ToSocketAddrs + ?Sized> ToSocketAddrs for &'a T { +impl<T: ToSocketAddrs + ?Sized> ToSocketAddrs for &T { type Iter = T::Iter; fn to_socket_addrs(&self) -> io::Result<T::Iter> { (**self).to_socket_addrs() diff --git a/src/libstd/net/tcp.rs b/src/libstd/net/tcp.rs index 86ecb10edf2..f0e6936e9da 100644 --- a/src/libstd/net/tcp.rs +++ b/src/libstd/net/tcp.rs @@ -580,7 +580,7 @@ impl Write for TcpStream { fn flush(&mut self) -> io::Result<()> { Ok(()) } } #[stable(feature = "rust1", since = "1.0.0")] -impl<'a> Read for &'a TcpStream { +impl Read for &TcpStream { fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> { self.0.read(buf) } #[inline] @@ -589,7 +589,7 @@ impl<'a> Read for &'a TcpStream { } } #[stable(feature = "rust1", since = "1.0.0")] -impl<'a> Write for &'a TcpStream { +impl Write for &TcpStream { fn write(&mut self, buf: &[u8]) -> io::Result<usize> { self.0.write(buf) } fn flush(&mut self) -> io::Result<()> { Ok(()) } } |
