1
Fork 0

libstd: deny(elided_lifetimes_in_paths)

This commit is contained in:
Mazdak Farrokhzad 2019-03-01 09:34:11 +01:00
parent cee58fdc12
commit 379c380a60
85 changed files with 372 additions and 367 deletions

View file

@ -323,7 +323,7 @@ fn has_redox_scheme(s: &[u8]) -> bool {
////////////////////////////////////////////////////////////////////////////////
/// Says whether the first byte after the prefix is a separator.
fn has_physical_root(s: &[u8], prefix: Option<Prefix>) -> bool {
fn has_physical_root(s: &[u8], prefix: Option<Prefix<'_>>) -> bool {
let path = if let Some(p) = prefix {
&s[p.len()..]
} else {
@ -630,11 +630,11 @@ pub struct Iter<'a> {
#[stable(feature = "path_components_debug", since = "1.13.0")]
impl fmt::Debug for Components<'_> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
struct DebugHelper<'a>(&'a Path);
impl fmt::Debug for DebugHelper<'_> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_list()
.entries(self.0.components())
.finish()
@ -828,11 +828,11 @@ impl AsRef<OsStr> for Components<'_> {
#[stable(feature = "path_iter_debug", since = "1.13.0")]
impl fmt::Debug for Iter<'_> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
struct DebugHelper<'a>(&'a Path);
impl fmt::Debug for DebugHelper<'_> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_list()
.entries(self.0.iter())
.finish()
@ -1559,7 +1559,7 @@ impl<P: AsRef<Path>> iter::Extend<P> for PathBuf {
#[stable(feature = "rust1", since = "1.0.0")]
impl fmt::Debug for PathBuf {
fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt::Debug::fmt(&**self, formatter)
}
}
@ -1857,7 +1857,7 @@ impl Path {
/// Had `path` contained invalid unicode, the `to_string_lossy` call might
/// have returned `"fo<66>.txt"`.
#[stable(feature = "rust1", since = "1.0.0")]
pub fn to_string_lossy(&self) -> Cow<str> {
pub fn to_string_lossy(&self) -> Cow<'_, str> {
self.inner.to_string_lossy()
}
@ -1926,7 +1926,7 @@ impl Path {
!self.is_absolute()
}
fn prefix(&self) -> Option<Prefix> {
fn prefix(&self) -> Option<Prefix<'_>> {
self.components().prefix
}
@ -2007,7 +2007,7 @@ impl Path {
/// [`None`]: ../../std/option/enum.Option.html#variant.None
/// [`parent`]: struct.Path.html#method.parent
#[stable(feature = "path_ancestors", since = "1.28.0")]
pub fn ancestors(&self) -> Ancestors {
pub fn ancestors(&self) -> Ancestors<'_> {
Ancestors {
next: Some(&self),
}
@ -2305,7 +2305,7 @@ impl Path {
/// [`Component`]: enum.Component.html
/// [`CurDir`]: enum.Component.html#variant.CurDir
#[stable(feature = "rust1", since = "1.0.0")]
pub fn components(&self) -> Components {
pub fn components(&self) -> Components<'_> {
let prefix = parse_prefix(self.as_os_str());
Components {
path: self.as_u8_slice(),
@ -2339,7 +2339,7 @@ impl Path {
/// assert_eq!(it.next(), None)
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub fn iter(&self) -> Iter {
pub fn iter(&self) -> Iter<'_> {
Iter { inner: self.components() }
}
@ -2358,7 +2358,7 @@ impl Path {
/// println!("{}", path.display());
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub fn display(&self) -> Display {
pub fn display(&self) -> Display<'_> {
Display { path: self }
}
@ -2578,7 +2578,7 @@ impl AsRef<OsStr> for Path {
#[stable(feature = "rust1", since = "1.0.0")]
impl fmt::Debug for Path {
fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt::Debug::fmt(&self.inner, formatter)
}
}
@ -2610,14 +2610,14 @@ pub struct Display<'a> {
#[stable(feature = "rust1", since = "1.0.0")]
impl fmt::Debug for Display<'_> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt::Debug::fmt(&self.path, f)
}
}
#[stable(feature = "rust1", since = "1.0.0")]
impl fmt::Display for Display<'_> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
self.path.inner.display(f)
}
}
@ -2805,7 +2805,7 @@ impl_cmp_os_str!(Cow<'a, Path>, OsString);
#[stable(since = "1.7.0", feature = "strip_prefix")]
impl fmt::Display for StripPrefixError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
self.description().fmt(f)
}
}
@ -2915,7 +2915,7 @@ mod tests {
{
let path: &Path = &pathbuf;
let borrowed_cow_path: Cow<Path> = path.into();
let borrowed_cow_path: Cow<'_, Path> = path.into();
assert_eq!(static_cow_path, borrowed_cow_path);
}
@ -4013,8 +4013,8 @@ mod tests {
let mut owned: PathBuf = PathBuf::new();
owned.push("foo");
owned.push("bar");
let borrowed_cow: Cow<Path> = borrowed.into();
let owned_cow: Cow<Path> = owned.clone().into();
let borrowed_cow: Cow<'_, Path> = borrowed.into();
let owned_cow: Cow<'_, Path> = owned.clone().into();
macro_rules! t {
($($current:expr),+) => {