diff options
| author | Scott McMurray <scottmcm@users.noreply.github.com> | 2019-03-09 19:10:28 -0800 |
|---|---|---|
| committer | Scott McMurray <scottmcm@users.noreply.github.com> | 2019-03-09 19:10:28 -0800 |
| commit | df4ea90b39c808e858e05f3b4bb05fc29f812d26 (patch) | |
| tree | 933b8174b4345eef7cd841265db05b552849823b /src/libstd | |
| parent | 26b4cb48484382032522384318e70ceb0fbc4a41 (diff) | |
| download | rust-df4ea90b39c808e858e05f3b4bb05fc29f812d26.tar.gz rust-df4ea90b39c808e858e05f3b4bb05fc29f812d26.zip | |
Use lifetime contravariance to elide more lifetimes in core+alloc+std
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/collections/hash/set.rs | 8 | ||||
| -rw-r--r-- | src/libstd/error.rs | 8 | ||||
| -rw-r--r-- | src/libstd/ffi/c_str.rs | 12 | ||||
| -rw-r--r-- | src/libstd/ffi/os_str.rs | 16 | ||||
| -rw-r--r-- | src/libstd/path.rs | 12 | ||||
| -rw-r--r-- | src/libstd/sys/cloudabi/shims/net.rs | 4 | ||||
| -rw-r--r-- | src/libstd/sys/redox/net/mod.rs | 2 | ||||
| -rw-r--r-- | src/libstd/sys/sgx/net.rs | 4 | ||||
| -rw-r--r-- | src/libstd/sys/unix/l4re.rs | 4 | ||||
| -rw-r--r-- | src/libstd/sys/wasm/net.rs | 4 | ||||
| -rw-r--r-- | src/libstd/sys_common/net.rs | 2 |
11 files changed, 38 insertions, 38 deletions
diff --git a/src/libstd/collections/hash/set.rs b/src/libstd/collections/hash/set.rs index 8a599c11b20..f2111f2d9e0 100644 --- a/src/libstd/collections/hash/set.rs +++ b/src/libstd/collections/hash/set.rs @@ -850,7 +850,7 @@ impl<T, S> Default for HashSet<T, S> } #[stable(feature = "rust1", since = "1.0.0")] -impl<'a, 'b, T, S> BitOr<&'b HashSet<T, S>> for &'a HashSet<T, S> +impl<T, S> BitOr<&HashSet<T, S>> for &HashSet<T, S> where T: Eq + Hash + Clone, S: BuildHasher + Default { @@ -882,7 +882,7 @@ impl<'a, 'b, T, S> BitOr<&'b HashSet<T, S>> for &'a HashSet<T, S> } #[stable(feature = "rust1", since = "1.0.0")] -impl<'a, 'b, T, S> BitAnd<&'b HashSet<T, S>> for &'a HashSet<T, S> +impl<T, S> BitAnd<&HashSet<T, S>> for &HashSet<T, S> where T: Eq + Hash + Clone, S: BuildHasher + Default { @@ -914,7 +914,7 @@ impl<'a, 'b, T, S> BitAnd<&'b HashSet<T, S>> for &'a HashSet<T, S> } #[stable(feature = "rust1", since = "1.0.0")] -impl<'a, 'b, T, S> BitXor<&'b HashSet<T, S>> for &'a HashSet<T, S> +impl<T, S> BitXor<&HashSet<T, S>> for &HashSet<T, S> where T: Eq + Hash + Clone, S: BuildHasher + Default { @@ -946,7 +946,7 @@ impl<'a, 'b, T, S> BitXor<&'b HashSet<T, S>> for &'a HashSet<T, S> } #[stable(feature = "rust1", since = "1.0.0")] -impl<'a, 'b, T, S> Sub<&'b HashSet<T, S>> for &'a HashSet<T, S> +impl<T, S> Sub<&HashSet<T, S>> for &HashSet<T, S> where T: Eq + Hash + Clone, S: BuildHasher + Default { diff --git a/src/libstd/error.rs b/src/libstd/error.rs index 2858308e8f8..3eb289501cb 100644 --- a/src/libstd/error.rs +++ b/src/libstd/error.rs @@ -337,7 +337,7 @@ impl From<String> for Box<dyn Error> { } #[stable(feature = "rust1", since = "1.0.0")] -impl<'a, 'b> From<&'b str> for Box<dyn Error + Send + Sync + 'a> { +impl<'a> From<&str> for Box<dyn Error + Send + Sync + 'a> { /// Converts a [`str`] into a box of dyn [`Error`] + [`Send`] + [`Sync`]. /// /// # Examples @@ -351,13 +351,13 @@ impl<'a, 'b> From<&'b str> for Box<dyn Error + Send + Sync + 'a> { /// assert!( /// mem::size_of::<Box<dyn Error + Send + Sync>>() == mem::size_of_val(&a_boxed_error)) /// ``` - fn from(err: &'b str) -> Box<dyn Error + Send + Sync + 'a> { + fn from(err: &str) -> Box<dyn Error + Send + Sync + 'a> { From::from(String::from(err)) } } #[stable(feature = "string_box_error", since = "1.6.0")] -impl<'a> From<&'a str> for Box<dyn Error> { +impl From<&str> for Box<dyn Error> { /// Converts a [`str`] into a box of dyn [`Error`]. /// /// # Examples @@ -370,7 +370,7 @@ impl<'a> From<&'a str> for Box<dyn Error> { /// let a_boxed_error = Box::<Error>::from(a_str_error); /// assert!(mem::size_of::<Box<dyn Error>>() == mem::size_of_val(&a_boxed_error)) /// ``` - fn from(err: &'a str) -> Box<dyn Error> { + fn from(err: &str) -> Box<dyn Error> { From::from(String::from(err)) } } diff --git a/src/libstd/ffi/c_str.rs b/src/libstd/ffi/c_str.rs index 139680e526f..ad3f45bfada 100644 --- a/src/libstd/ffi/c_str.rs +++ b/src/libstd/ffi/c_str.rs @@ -690,8 +690,8 @@ impl<'a> From<Cow<'a, CStr>> for CString { } #[stable(feature = "box_from_c_str", since = "1.17.0")] -impl<'a> From<&'a CStr> for Box<CStr> { - fn from(s: &'a CStr) -> Box<CStr> { +impl From<&CStr> for Box<CStr> { + fn from(s: &CStr) -> Box<CStr> { let boxed: Box<[u8]> = Box::from(s.to_bytes_with_nul()); unsafe { Box::from_raw(Box::into_raw(boxed) as *mut CStr) } } @@ -767,7 +767,7 @@ impl From<CString> for Arc<CStr> { } #[stable(feature = "shared_from_slice2", since = "1.24.0")] -impl<'a> From<&'a CStr> for Arc<CStr> { +impl From<&CStr> for Arc<CStr> { #[inline] fn from(s: &CStr) -> Arc<CStr> { let arc: Arc<[u8]> = Arc::from(s.to_bytes_with_nul()); @@ -789,7 +789,7 @@ impl From<CString> for Rc<CStr> { } #[stable(feature = "shared_from_slice2", since = "1.24.0")] -impl<'a> From<&'a CStr> for Rc<CStr> { +impl From<&CStr> for Rc<CStr> { #[inline] fn from(s: &CStr) -> Rc<CStr> { let rc: Rc<[u8]> = Rc::from(s.to_bytes_with_nul()); @@ -1268,8 +1268,8 @@ impl ToOwned for CStr { } #[stable(feature = "cstring_asref", since = "1.7.0")] -impl<'a> From<&'a CStr> for CString { - fn from(s: &'a CStr) -> CString { +impl From<&CStr> for CString { + fn from(s: &CStr) -> CString { s.to_owned() } } diff --git a/src/libstd/ffi/os_str.rs b/src/libstd/ffi/os_str.rs index f68eaeb9c7e..3a0590021c9 100644 --- a/src/libstd/ffi/os_str.rs +++ b/src/libstd/ffi/os_str.rs @@ -357,8 +357,8 @@ impl From<String> for OsString { } #[stable(feature = "rust1", since = "1.0.0")] -impl<'a, T: ?Sized + AsRef<OsStr>> From<&'a T> for OsString { - fn from(s: &'a T) -> OsString { +impl<T: ?Sized + AsRef<OsStr>> From<&T> for OsString { + fn from(s: &T) -> OsString { s.as_ref().to_os_string() } } @@ -421,8 +421,8 @@ impl PartialEq<OsString> for str { } #[stable(feature = "os_str_str_ref_eq", since = "1.29.0")] -impl<'a> PartialEq<&'a str> for OsString { - fn eq(&self, other: &&'a str) -> bool { +impl PartialEq<&str> for OsString { + fn eq(&self, other: &&str) -> bool { **self == **other } } @@ -656,8 +656,8 @@ impl OsStr { } #[stable(feature = "box_from_os_str", since = "1.17.0")] -impl<'a> From<&'a OsStr> for Box<OsStr> { - fn from(s: &'a OsStr) -> Box<OsStr> { +impl From<&OsStr> for Box<OsStr> { + fn from(s: &OsStr) -> Box<OsStr> { let rw = Box::into_raw(s.inner.into_box()) as *mut OsStr; unsafe { Box::from_raw(rw) } } @@ -707,7 +707,7 @@ impl From<OsString> for Arc<OsStr> { } #[stable(feature = "shared_from_slice2", since = "1.24.0")] -impl<'a> From<&'a OsStr> for Arc<OsStr> { +impl From<&OsStr> for Arc<OsStr> { #[inline] fn from(s: &OsStr) -> Arc<OsStr> { let arc = s.inner.into_arc(); @@ -729,7 +729,7 @@ impl From<OsString> for Rc<OsStr> { } #[stable(feature = "shared_from_slice2", since = "1.24.0")] -impl<'a> From<&'a OsStr> for Rc<OsStr> { +impl From<&OsStr> for Rc<OsStr> { #[inline] fn from(s: &OsStr) -> Rc<OsStr> { let rc = s.inner.into_rc(); diff --git a/src/libstd/path.rs b/src/libstd/path.rs index 858a5778b81..ea3fcd8ce28 100644 --- a/src/libstd/path.rs +++ b/src/libstd/path.rs @@ -1456,8 +1456,8 @@ impl PathBuf { } #[stable(feature = "box_from_path", since = "1.17.0")] -impl<'a> From<&'a Path> for Box<Path> { - fn from(path: &'a Path) -> Box<Path> { +impl From<&Path> for Box<Path> { + fn from(path: &Path) -> Box<Path> { let boxed: Box<OsStr> = path.inner.into(); let rw = Box::into_raw(boxed) as *mut Path; unsafe { Box::from_raw(rw) } @@ -1494,8 +1494,8 @@ impl Clone for Box<Path> { } #[stable(feature = "rust1", since = "1.0.0")] -impl<'a, T: ?Sized + AsRef<OsStr>> From<&'a T> for PathBuf { - fn from(s: &'a T) -> PathBuf { +impl<T: ?Sized + AsRef<OsStr>> From<&T> for PathBuf { + fn from(s: &T) -> PathBuf { PathBuf::from(s.as_ref().to_os_string()) } } @@ -1630,7 +1630,7 @@ impl From<PathBuf> for Arc<Path> { } #[stable(feature = "shared_from_slice2", since = "1.24.0")] -impl<'a> From<&'a Path> for Arc<Path> { +impl From<&Path> for Arc<Path> { /// Converts a Path into a Rc by copying the Path data into a new Rc buffer. #[inline] fn from(s: &Path) -> Arc<Path> { @@ -1650,7 +1650,7 @@ impl From<PathBuf> for Rc<Path> { } #[stable(feature = "shared_from_slice2", since = "1.24.0")] -impl<'a> From<&'a Path> for Rc<Path> { +impl From<&Path> for Rc<Path> { /// Converts a Path into a Rc by copying the Path data into a new Rc buffer. #[inline] fn from(s: &Path) -> Rc<Path> { diff --git a/src/libstd/sys/cloudabi/shims/net.rs b/src/libstd/sys/cloudabi/shims/net.rs index 50d72dc7b24..6d2a4962ab4 100644 --- a/src/libstd/sys/cloudabi/shims/net.rs +++ b/src/libstd/sys/cloudabi/shims/net.rs @@ -297,10 +297,10 @@ impl Iterator for LookupHost { } } -impl<'a> TryFrom<&'a str> for LookupHost { +impl TryFrom<&str> for LookupHost { type Error = io::Error; - fn try_from(_v: &'a str) -> io::Result<LookupHost> { + fn try_from(_v: &str) -> io::Result<LookupHost> { unsupported() } } diff --git a/src/libstd/sys/redox/net/mod.rs b/src/libstd/sys/redox/net/mod.rs index a172763f613..dbaa140ed8a 100644 --- a/src/libstd/sys/redox/net/mod.rs +++ b/src/libstd/sys/redox/net/mod.rs @@ -35,7 +35,7 @@ impl Iterator for LookupHost { } } -impl<'a> TryFrom<&'a str> for LookupHost { +impl TryFrom<&str> for LookupHost { type Error = io::Error; fn try_from(s: &str) -> io::Result<LookupHost> { diff --git a/src/libstd/sys/sgx/net.rs b/src/libstd/sys/sgx/net.rs index ab8b2681393..e5e42e3d0b0 100644 --- a/src/libstd/sys/sgx/net.rs +++ b/src/libstd/sys/sgx/net.rs @@ -420,10 +420,10 @@ impl Iterator for LookupHost { } } -impl<'a> TryFrom<&'a str> for LookupHost { +impl TryFrom<&str> for LookupHost { type Error = io::Error; - fn try_from(v: &'a str) -> io::Result<LookupHost> { + fn try_from(v: &str) -> io::Result<LookupHost> { LookupHost::new(v.to_owned()) } } diff --git a/src/libstd/sys/unix/l4re.rs b/src/libstd/sys/unix/l4re.rs index b6e8cc73894..b9e725371a3 100644 --- a/src/libstd/sys/unix/l4re.rs +++ b/src/libstd/sys/unix/l4re.rs @@ -447,10 +447,10 @@ pub mod net { unsafe impl Send for LookupHost {} - impl<'a> TryFrom<&'a str> for LookupHost { + impl TryFrom<&str> for LookupHost { type Error = io::Error; - fn try_from(_v: &'a str) -> io::Result<LookupHost> { + fn try_from(_v: &str) -> io::Result<LookupHost> { unimpl!(); } } diff --git a/src/libstd/sys/wasm/net.rs b/src/libstd/sys/wasm/net.rs index 1249832fb09..a2ea2dfbbc0 100644 --- a/src/libstd/sys/wasm/net.rs +++ b/src/libstd/sys/wasm/net.rs @@ -298,10 +298,10 @@ impl Iterator for LookupHost { } } -impl<'a> TryFrom<&'a str> for LookupHost { +impl TryFrom<&str> for LookupHost { type Error = io::Error; - fn try_from(_v: &'a str) -> io::Result<LookupHost> { + fn try_from(_v: &str) -> io::Result<LookupHost> { unsupported() } } diff --git a/src/libstd/sys_common/net.rs b/src/libstd/sys_common/net.rs index 36721171b17..b9505aaa69b 100644 --- a/src/libstd/sys_common/net.rs +++ b/src/libstd/sys_common/net.rs @@ -157,7 +157,7 @@ impl Drop for LookupHost { } } -impl<'a> TryFrom<&'a str> for LookupHost { +impl TryFrom<&str> for LookupHost { type Error = io::Error; fn try_from(s: &str) -> io::Result<LookupHost> { |
