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.
This commit is contained in:
parent
16ca0b9f63
commit
3bea2ca49d
35 changed files with 219 additions and 219 deletions
|
@ -457,14 +457,14 @@ impl<'a> cmp::PartialOrd for PrefixComponent<'a> {
|
|||
}
|
||||
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<'a> cmp::Ord for PrefixComponent<'a> {
|
||||
fn cmp(&self, other: &PrefixComponent<'a>) -> cmp::Ordering {
|
||||
impl cmp::Ord for PrefixComponent<'_> {
|
||||
fn cmp(&self, other: &Self) -> cmp::Ordering {
|
||||
cmp::Ord::cmp(&self.parsed, &other.parsed)
|
||||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<'a> Hash for PrefixComponent<'a> {
|
||||
impl Hash for PrefixComponent<'_> {
|
||||
fn hash<H: Hasher>(&self, h: &mut H) {
|
||||
self.parsed.hash(h);
|
||||
}
|
||||
|
@ -561,14 +561,14 @@ impl<'a> Component<'a> {
|
|||
}
|
||||
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<'a> AsRef<OsStr> for Component<'a> {
|
||||
impl AsRef<OsStr> for Component<'_> {
|
||||
fn as_ref(&self) -> &OsStr {
|
||||
self.as_os_str()
|
||||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "path_component_asref", since = "1.25.0")]
|
||||
impl<'a> AsRef<Path> for Component<'a> {
|
||||
impl AsRef<Path> for Component<'_> {
|
||||
fn as_ref(&self) -> &Path {
|
||||
self.as_os_str().as_ref()
|
||||
}
|
||||
|
@ -630,11 +630,11 @@ pub struct Iter<'a> {
|
|||
}
|
||||
|
||||
#[stable(feature = "path_components_debug", since = "1.13.0")]
|
||||
impl<'a> fmt::Debug for Components<'a> {
|
||||
impl fmt::Debug for Components<'_> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
struct DebugHelper<'a>(&'a Path);
|
||||
|
||||
impl<'a> fmt::Debug for DebugHelper<'a> {
|
||||
impl fmt::Debug for DebugHelper<'_> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
f.debug_list()
|
||||
.entries(self.0.components())
|
||||
|
@ -814,25 +814,25 @@ impl<'a> Components<'a> {
|
|||
}
|
||||
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<'a> AsRef<Path> for Components<'a> {
|
||||
impl AsRef<Path> for Components<'_> {
|
||||
fn as_ref(&self) -> &Path {
|
||||
self.as_path()
|
||||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<'a> AsRef<OsStr> for Components<'a> {
|
||||
impl AsRef<OsStr> for Components<'_> {
|
||||
fn as_ref(&self) -> &OsStr {
|
||||
self.as_path().as_os_str()
|
||||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "path_iter_debug", since = "1.13.0")]
|
||||
impl<'a> fmt::Debug for Iter<'a> {
|
||||
impl fmt::Debug for Iter<'_> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
struct DebugHelper<'a>(&'a Path);
|
||||
|
||||
impl<'a> fmt::Debug for DebugHelper<'a> {
|
||||
impl fmt::Debug for DebugHelper<'_> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
f.debug_list()
|
||||
.entries(self.0.iter())
|
||||
|
@ -867,14 +867,14 @@ impl<'a> Iter<'a> {
|
|||
}
|
||||
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<'a> AsRef<Path> for Iter<'a> {
|
||||
impl AsRef<Path> for Iter<'_> {
|
||||
fn as_ref(&self) -> &Path {
|
||||
self.as_path()
|
||||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<'a> AsRef<OsStr> for Iter<'a> {
|
||||
impl AsRef<OsStr> for Iter<'_> {
|
||||
fn as_ref(&self) -> &OsStr {
|
||||
self.as_path().as_os_str()
|
||||
}
|
||||
|
@ -897,7 +897,7 @@ impl<'a> DoubleEndedIterator for Iter<'a> {
|
|||
}
|
||||
|
||||
#[stable(feature = "fused", since = "1.26.0")]
|
||||
impl<'a> FusedIterator for Iter<'a> {}
|
||||
impl FusedIterator for Iter<'_> {}
|
||||
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<'a> Iterator for Components<'a> {
|
||||
|
@ -1000,7 +1000,7 @@ impl<'a> DoubleEndedIterator for Components<'a> {
|
|||
}
|
||||
|
||||
#[stable(feature = "fused", since = "1.26.0")]
|
||||
impl<'a> FusedIterator for Components<'a> {}
|
||||
impl FusedIterator for Components<'_> {}
|
||||
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<'a> cmp::PartialEq for Components<'a> {
|
||||
|
@ -1010,7 +1010,7 @@ impl<'a> cmp::PartialEq for Components<'a> {
|
|||
}
|
||||
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<'a> cmp::Eq for Components<'a> {}
|
||||
impl cmp::Eq for Components<'_> {}
|
||||
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<'a> cmp::PartialOrd for Components<'a> {
|
||||
|
@ -1020,8 +1020,8 @@ impl<'a> cmp::PartialOrd for Components<'a> {
|
|||
}
|
||||
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<'a> cmp::Ord for Components<'a> {
|
||||
fn cmp(&self, other: &Components<'a>) -> cmp::Ordering {
|
||||
impl cmp::Ord for Components<'_> {
|
||||
fn cmp(&self, other: &Self) -> cmp::Ordering {
|
||||
Iterator::cmp(self.clone(), other.clone())
|
||||
}
|
||||
}
|
||||
|
@ -1063,7 +1063,7 @@ impl<'a> Iterator for Ancestors<'a> {
|
|||
}
|
||||
|
||||
#[stable(feature = "path_ancestors", since = "1.28.0")]
|
||||
impl<'a> FusedIterator for Ancestors<'a> {}
|
||||
impl FusedIterator for Ancestors<'_> {}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Basic types and traits
|
||||
|
@ -2530,14 +2530,14 @@ pub struct Display<'a> {
|
|||
}
|
||||
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<'a> fmt::Debug for Display<'a> {
|
||||
impl fmt::Debug for Display<'_> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
fmt::Debug::fmt(&self.path, f)
|
||||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<'a> fmt::Display for Display<'a> {
|
||||
impl fmt::Display for Display<'_> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
self.path.inner.display(f)
|
||||
}
|
||||
|
@ -2591,7 +2591,7 @@ impl AsRef<Path> for OsStr {
|
|||
}
|
||||
|
||||
#[stable(feature = "cow_os_str_as_ref_path", since = "1.8.0")]
|
||||
impl<'a> AsRef<Path> for Cow<'a, OsStr> {
|
||||
impl AsRef<Path> for Cow<'_, OsStr> {
|
||||
fn as_ref(&self) -> &Path {
|
||||
Path::new(self)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue