about summary refs log tree commit diff
path: root/src/libcore/fmt
diff options
context:
space:
mode:
authorMazdak Farrokhzad <twingoow@gmail.com>2019-04-19 01:37:12 +0200
committerMazdak Farrokhzad <twingoow@gmail.com>2019-04-19 01:37:12 +0200
commitdbfbadeac4f593e31bbcb57bc7c3b1d17ab1cd65 (patch)
tree0145cabc176d4046b0b4dc8f50b203a2e9a37e0d /src/libcore/fmt
parent5d20ff4d2718c820632b38c1e49d4de648a9810b (diff)
downloadrust-dbfbadeac4f593e31bbcb57bc7c3b1d17ab1cd65.tar.gz
rust-dbfbadeac4f593e31bbcb57bc7c3b1d17ab1cd65.zip
libcore: deny more...
Diffstat (limited to 'src/libcore/fmt')
-rw-r--r--src/libcore/fmt/builders.rs2
-rw-r--r--src/libcore/fmt/float.rs28
-rw-r--r--src/libcore/fmt/mod.rs126
-rw-r--r--src/libcore/fmt/num.rs10
4 files changed, 83 insertions, 83 deletions
diff --git a/src/libcore/fmt/builders.rs b/src/libcore/fmt/builders.rs
index e78381ba0c4..df86da5fc39 100644
--- a/src/libcore/fmt/builders.rs
+++ b/src/libcore/fmt/builders.rs
@@ -6,7 +6,7 @@ struct PadAdapter<'a> {
 }
 
 impl<'a> PadAdapter<'a> {
-    fn wrap<'b, 'c: 'a+'b>(fmt: &'c mut fmt::Formatter, slot: &'b mut Option<Self>)
+    fn wrap<'b, 'c: 'a+'b>(fmt: &'c mut fmt::Formatter<'_>, slot: &'b mut Option<Self>)
                         -> fmt::Formatter<'b> {
         fmt.wrap_buf(move |buf| {
             *slot = Some(PadAdapter {
diff --git a/src/libcore/fmt/float.rs b/src/libcore/fmt/float.rs
index 5fc2cd4b8d0..4bd7d3b4b22 100644
--- a/src/libcore/fmt/float.rs
+++ b/src/libcore/fmt/float.rs
@@ -5,13 +5,13 @@ use crate::num::flt2dec;
 // Don't inline this so callers don't use the stack space this function
 // requires unless they have to.
 #[inline(never)]
-fn float_to_decimal_common_exact<T>(fmt: &mut Formatter, num: &T,
+fn float_to_decimal_common_exact<T>(fmt: &mut Formatter<'_>, num: &T,
                                     sign: flt2dec::Sign, precision: usize) -> Result
     where T: flt2dec::DecodableFloat
 {
     unsafe {
         let mut buf = MaybeUninit::<[u8; 1024]>::uninit(); // enough for f32 and f64
-        let mut parts = MaybeUninit::<[flt2dec::Part; 4]>::uninit();
+        let mut parts = MaybeUninit::<[flt2dec::Part<'_>; 4]>::uninit();
         // FIXME(#53491): Technically, this is calling `get_mut` on an uninitialized
         // `MaybeUninit` (here and elsewhere in this file).  Revisit this once
         // we decided whether that is valid or not.
@@ -26,14 +26,14 @@ fn float_to_decimal_common_exact<T>(fmt: &mut Formatter, num: &T,
 // Don't inline this so callers that call both this and the above won't wind
 // up using the combined stack space of both functions in some cases.
 #[inline(never)]
-fn float_to_decimal_common_shortest<T>(fmt: &mut Formatter, num: &T,
+fn float_to_decimal_common_shortest<T>(fmt: &mut Formatter<'_>, num: &T,
                                        sign: flt2dec::Sign, precision: usize) -> Result
     where T: flt2dec::DecodableFloat
 {
     unsafe {
         // enough for f32 and f64
         let mut buf = MaybeUninit::<[u8; flt2dec::MAX_SIG_DIGITS]>::uninit();
-        let mut parts = MaybeUninit::<[flt2dec::Part; 4]>::uninit();
+        let mut parts = MaybeUninit::<[flt2dec::Part<'_>; 4]>::uninit();
         // FIXME(#53491)
         let formatted = flt2dec::to_shortest_str(flt2dec::strategy::grisu::format_shortest, *num,
                                                  sign, precision, false, buf.get_mut(),
@@ -43,7 +43,7 @@ fn float_to_decimal_common_shortest<T>(fmt: &mut Formatter, num: &T,
 }
 
 // Common code of floating point Debug and Display.
-fn float_to_decimal_common<T>(fmt: &mut Formatter, num: &T,
+fn float_to_decimal_common<T>(fmt: &mut Formatter<'_>, num: &T,
                               negative_zero: bool, min_precision: usize) -> Result
     where T: flt2dec::DecodableFloat
 {
@@ -65,14 +65,14 @@ fn float_to_decimal_common<T>(fmt: &mut Formatter, num: &T,
 // Don't inline this so callers don't use the stack space this function
 // requires unless they have to.
 #[inline(never)]
-fn float_to_exponential_common_exact<T>(fmt: &mut Formatter, num: &T,
+fn float_to_exponential_common_exact<T>(fmt: &mut Formatter<'_>, num: &T,
                                         sign: flt2dec::Sign, precision: usize,
                                         upper: bool) -> Result
     where T: flt2dec::DecodableFloat
 {
     unsafe {
         let mut buf = MaybeUninit::<[u8; 1024]>::uninit(); // enough for f32 and f64
-        let mut parts = MaybeUninit::<[flt2dec::Part; 6]>::uninit();
+        let mut parts = MaybeUninit::<[flt2dec::Part<'_>; 6]>::uninit();
         // FIXME(#53491)
         let formatted = flt2dec::to_exact_exp_str(flt2dec::strategy::grisu::format_exact,
                                                   *num, sign, precision,
@@ -84,7 +84,7 @@ fn float_to_exponential_common_exact<T>(fmt: &mut Formatter, num: &T,
 // Don't inline this so callers that call both this and the above won't wind
 // up using the combined stack space of both functions in some cases.
 #[inline(never)]
-fn float_to_exponential_common_shortest<T>(fmt: &mut Formatter,
+fn float_to_exponential_common_shortest<T>(fmt: &mut Formatter<'_>,
                                            num: &T, sign: flt2dec::Sign,
                                            upper: bool) -> Result
     where T: flt2dec::DecodableFloat
@@ -92,7 +92,7 @@ fn float_to_exponential_common_shortest<T>(fmt: &mut Formatter,
     unsafe {
         // enough for f32 and f64
         let mut buf = MaybeUninit::<[u8; flt2dec::MAX_SIG_DIGITS]>::uninit();
-        let mut parts = MaybeUninit::<[flt2dec::Part; 6]>::uninit();
+        let mut parts = MaybeUninit::<[flt2dec::Part<'_>; 6]>::uninit();
         // FIXME(#53491)
         let formatted = flt2dec::to_shortest_exp_str(flt2dec::strategy::grisu::format_shortest,
                                                      *num, sign, (0, 0), upper,
@@ -102,7 +102,7 @@ fn float_to_exponential_common_shortest<T>(fmt: &mut Formatter,
 }
 
 // Common code of floating point LowerExp and UpperExp.
-fn float_to_exponential_common<T>(fmt: &mut Formatter, num: &T, upper: bool) -> Result
+fn float_to_exponential_common<T>(fmt: &mut Formatter<'_>, num: &T, upper: bool) -> Result
     where T: flt2dec::DecodableFloat
 {
     let force_sign = fmt.sign_plus();
@@ -123,28 +123,28 @@ macro_rules! floating {
     ($ty:ident) => (
         #[stable(feature = "rust1", since = "1.0.0")]
         impl Debug for $ty {
-            fn fmt(&self, fmt: &mut Formatter) -> Result {
+            fn fmt(&self, fmt: &mut Formatter<'_>) -> Result {
                 float_to_decimal_common(fmt, self, true, 1)
             }
         }
 
         #[stable(feature = "rust1", since = "1.0.0")]
         impl Display for $ty {
-            fn fmt(&self, fmt: &mut Formatter) -> Result {
+            fn fmt(&self, fmt: &mut Formatter<'_>) -> Result {
                 float_to_decimal_common(fmt, self, false, 0)
             }
         }
 
         #[stable(feature = "rust1", since = "1.0.0")]
         impl LowerExp for $ty {
-            fn fmt(&self, fmt: &mut Formatter) -> Result {
+            fn fmt(&self, fmt: &mut Formatter<'_>) -> Result {
                 float_to_exponential_common(fmt, self, false)
             }
         }
 
         #[stable(feature = "rust1", since = "1.0.0")]
         impl UpperExp for $ty {
-            fn fmt(&self, fmt: &mut Formatter) -> Result {
+            fn fmt(&self, fmt: &mut Formatter<'_>) -> Result {
                 float_to_exponential_common(fmt, self, true)
             }
         }
diff --git a/src/libcore/fmt/mod.rs b/src/libcore/fmt/mod.rs
index 1ccd6ec898f..43c1a3b7767 100644
--- a/src/libcore/fmt/mod.rs
+++ b/src/libcore/fmt/mod.rs
@@ -55,7 +55,7 @@ pub mod rt {
 /// }
 ///
 /// impl fmt::Display for Triangle {
-///     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+///     fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
 ///         write!(f, "({}, {}, {})", self.a, self.b, self.c)
 ///     }
 /// }
@@ -191,7 +191,7 @@ pub trait Write {
     /// assert_eq!(&buf, "world");
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
-    fn write_fmt(mut self: &mut Self, args: Arguments) -> Result {
+    fn write_fmt(mut self: &mut Self, args: Arguments<'_>) -> Result {
         write(&mut self, args)
     }
 }
@@ -206,7 +206,7 @@ impl<W: Write + ?Sized> Write for &mut W {
         (**self).write_char(c)
     }
 
-    fn write_fmt(&mut self, args: Arguments) -> Result {
+    fn write_fmt(&mut self, args: Arguments<'_>) -> Result {
         (**self).write_fmt(args)
     }
 }
@@ -238,7 +238,7 @@ pub struct Formatter<'a> {
 }
 
 // NB. Argument is essentially an optimized partially applied formatting function,
-// equivalent to `exists T.(&T, fn(&T, &mut Formatter) -> Result`.
+// equivalent to `exists T.(&T, fn(&T, &mut Formatter<'_>) -> Result`.
 
 struct Void {
     _priv: (),
@@ -263,12 +263,12 @@ struct Void {
 #[doc(hidden)]
 pub struct ArgumentV1<'a> {
     value: &'a Void,
-    formatter: fn(&Void, &mut Formatter) -> Result,
+    formatter: fn(&Void, &mut Formatter<'_>) -> Result,
 }
 
 impl<'a> ArgumentV1<'a> {
     #[inline(never)]
-    fn show_usize(x: &usize, f: &mut Formatter) -> Result {
+    fn show_usize(x: &usize, f: &mut Formatter<'_>) -> Result {
         Display::fmt(x, f)
     }
 
@@ -276,7 +276,7 @@ impl<'a> ArgumentV1<'a> {
     #[unstable(feature = "fmt_internals", reason = "internal to format_args!",
                issue = "0")]
     pub fn new<'b, T>(x: &'b T,
-                      f: fn(&T, &mut Formatter) -> Result) -> ArgumentV1<'b> {
+                      f: fn(&T, &mut Formatter<'_>) -> Result) -> ArgumentV1<'b> {
         unsafe {
             ArgumentV1 {
                 formatter: mem::transmute(f),
@@ -288,7 +288,7 @@ impl<'a> ArgumentV1<'a> {
     #[doc(hidden)]
     #[unstable(feature = "fmt_internals", reason = "internal to format_args!",
                issue = "0")]
-    pub fn from_usize(x: &usize) -> ArgumentV1 {
+    pub fn from_usize(x: &usize) -> ArgumentV1<'_> {
         ArgumentV1::new(x, ArgumentV1::show_usize)
     }
 
@@ -406,14 +406,14 @@ pub struct Arguments<'a> {
 
 #[stable(feature = "rust1", since = "1.0.0")]
 impl Debug for Arguments<'_> {
-    fn fmt(&self, fmt: &mut Formatter) -> Result {
+    fn fmt(&self, fmt: &mut Formatter<'_>) -> Result {
         Display::fmt(self, fmt)
     }
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
 impl Display for Arguments<'_> {
-    fn fmt(&self, fmt: &mut Formatter) -> Result {
+    fn fmt(&self, fmt: &mut Formatter<'_>) -> Result {
         write(fmt.buf, *self)
     }
 }
@@ -463,7 +463,7 @@ impl Display for Arguments<'_> {
 /// }
 ///
 /// impl fmt::Debug for Point {
-///     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+///     fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
 ///         write!(f, "Point {{ x: {}, y: {} }}", self.x, self.y)
 ///     }
 /// }
@@ -533,7 +533,7 @@ pub trait Debug {
     /// }
     ///
     /// impl fmt::Debug for Position {
-    ///     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+    ///     fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
     ///         write!(f, "({:?}, {:?})", self.longitude, self.latitude)
     ///     }
     /// }
@@ -542,7 +542,7 @@ pub trait Debug {
     ///            format!("{:?}", Position { longitude: 1.987, latitude: 2.983, }));
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
-    fn fmt(&self, f: &mut Formatter) -> Result;
+    fn fmt(&self, f: &mut Formatter<'_>) -> Result;
 }
 
 /// Format trait for an empty format, `{}`.
@@ -569,7 +569,7 @@ pub trait Debug {
 /// }
 ///
 /// impl fmt::Display for Point {
-///     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+///     fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
 ///         write!(f, "({}, {})", self.x, self.y)
 ///     }
 /// }
@@ -605,7 +605,7 @@ pub trait Display {
     /// }
     ///
     /// impl fmt::Display for Position {
-    ///     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+    ///     fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
     ///         write!(f, "({}, {})", self.longitude, self.latitude)
     ///     }
     /// }
@@ -614,7 +614,7 @@ pub trait Display {
     ///            format!("{}", Position { longitude: 1.987, latitude: 2.983, }));
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
-    fn fmt(&self, f: &mut Formatter) -> Result;
+    fn fmt(&self, f: &mut Formatter<'_>) -> Result;
 }
 
 /// `o` formatting.
@@ -651,7 +651,7 @@ pub trait Display {
 /// struct Length(i32);
 ///
 /// impl fmt::Octal for Length {
-///     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+///     fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
 ///         let val = self.0;
 ///
 ///         write!(f, "{:o}", val) // delegate to i32's implementation
@@ -666,7 +666,7 @@ pub trait Display {
 pub trait Octal {
     /// Formats the value using the given formatter.
     #[stable(feature = "rust1", since = "1.0.0")]
-    fn fmt(&self, f: &mut Formatter) -> Result;
+    fn fmt(&self, f: &mut Formatter<'_>) -> Result;
 }
 
 /// `b` formatting.
@@ -701,7 +701,7 @@ pub trait Octal {
 /// struct Length(i32);
 ///
 /// impl fmt::Binary for Length {
-///     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+///     fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
 ///         let val = self.0;
 ///
 ///         write!(f, "{:b}", val) // delegate to i32's implementation
@@ -722,7 +722,7 @@ pub trait Octal {
 pub trait Binary {
     /// Formats the value using the given formatter.
     #[stable(feature = "rust1", since = "1.0.0")]
-    fn fmt(&self, f: &mut Formatter) -> Result;
+    fn fmt(&self, f: &mut Formatter<'_>) -> Result;
 }
 
 /// `x` formatting.
@@ -760,7 +760,7 @@ pub trait Binary {
 /// struct Length(i32);
 ///
 /// impl fmt::LowerHex for Length {
-///     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+///     fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
 ///         let val = self.0;
 ///
 ///         write!(f, "{:x}", val) // delegate to i32's implementation
@@ -775,7 +775,7 @@ pub trait Binary {
 pub trait LowerHex {
     /// Formats the value using the given formatter.
     #[stable(feature = "rust1", since = "1.0.0")]
-    fn fmt(&self, f: &mut Formatter) -> Result;
+    fn fmt(&self, f: &mut Formatter<'_>) -> Result;
 }
 
 /// `X` formatting.
@@ -813,7 +813,7 @@ pub trait LowerHex {
 /// struct Length(i32);
 ///
 /// impl fmt::UpperHex for Length {
-///     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+///     fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
 ///         let val = self.0;
 ///
 ///         write!(f, "{:X}", val) // delegate to i32's implementation
@@ -828,7 +828,7 @@ pub trait LowerHex {
 pub trait UpperHex {
     /// Formats the value using the given formatter.
     #[stable(feature = "rust1", since = "1.0.0")]
-    fn fmt(&self, f: &mut Formatter) -> Result;
+    fn fmt(&self, f: &mut Formatter<'_>) -> Result;
 }
 
 /// `p` formatting.
@@ -858,7 +858,7 @@ pub trait UpperHex {
 /// struct Length(i32);
 ///
 /// impl fmt::Pointer for Length {
-///     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+///     fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
 ///         // use `as` to convert to a `*const T`, which implements Pointer, which we can use
 ///
 ///         write!(f, "{:p}", self as *const Length)
@@ -873,7 +873,7 @@ pub trait UpperHex {
 pub trait Pointer {
     /// Formats the value using the given formatter.
     #[stable(feature = "rust1", since = "1.0.0")]
-    fn fmt(&self, f: &mut Formatter) -> Result;
+    fn fmt(&self, f: &mut Formatter<'_>) -> Result;
 }
 
 /// `e` formatting.
@@ -902,7 +902,7 @@ pub trait Pointer {
 /// struct Length(i32);
 ///
 /// impl fmt::LowerExp for Length {
-///     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+///     fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
 ///         let val = self.0;
 ///         write!(f, "{}e1", val / 10)
 ///     }
@@ -916,7 +916,7 @@ pub trait Pointer {
 pub trait LowerExp {
     /// Formats the value using the given formatter.
     #[stable(feature = "rust1", since = "1.0.0")]
-    fn fmt(&self, f: &mut Formatter) -> Result;
+    fn fmt(&self, f: &mut Formatter<'_>) -> Result;
 }
 
 /// `E` formatting.
@@ -945,7 +945,7 @@ pub trait LowerExp {
 /// struct Length(i32);
 ///
 /// impl fmt::UpperExp for Length {
-///     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+///     fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
 ///         let val = self.0;
 ///         write!(f, "{}E1", val / 10)
 ///     }
@@ -959,7 +959,7 @@ pub trait LowerExp {
 pub trait UpperExp {
     /// Formats the value using the given formatter.
     #[stable(feature = "rust1", since = "1.0.0")]
-    fn fmt(&self, f: &mut Formatter) -> Result;
+    fn fmt(&self, f: &mut Formatter<'_>) -> Result;
 }
 
 /// The `write` function takes an output stream, and an `Arguments` struct
@@ -994,7 +994,7 @@ pub trait UpperExp {
 ///
 /// [`write!`]: ../../std/macro.write.html
 #[stable(feature = "rust1", since = "1.0.0")]
-pub fn write(output: &mut dyn Write, args: Arguments) -> Result {
+pub fn write(output: &mut dyn Write, args: Arguments<'_>) -> Result {
     let mut formatter = Formatter {
         flags: 0,
         width: None,
@@ -1183,7 +1183,7 @@ impl<'a> Formatter<'a> {
 
         // Writes the sign if it exists, and then the prefix if it was requested
         #[inline(never)]
-        fn write_prefix(f: &mut Formatter, sign: Option<char>, prefix: Option<&str>) -> Result {
+        fn write_prefix(f: &mut Formatter<'_>, sign: Option<char>, prefix: Option<&str>) -> Result {
             if let Some(c) = sign {
                 f.buf.write_char(c)?;
             }
@@ -1331,7 +1331,7 @@ impl<'a> Formatter<'a> {
     /// Takes the formatted parts and applies the padding.
     /// Assumes that the caller already has rendered the parts with required precision,
     /// so that `self.precision` can be ignored.
-    fn pad_formatted_parts(&mut self, formatted: &flt2dec::Formatted) -> Result {
+    fn pad_formatted_parts(&mut self, formatted: &flt2dec::Formatted<'_>) -> Result {
         if let Some(mut width) = self.width {
             // for the sign-aware zero padding, we render the sign first and
             // behave as if we had no sign from the beginning.
@@ -1370,7 +1370,7 @@ impl<'a> Formatter<'a> {
         }
     }
 
-    fn write_formatted_parts(&mut self, formatted: &flt2dec::Formatted) -> Result {
+    fn write_formatted_parts(&mut self, formatted: &flt2dec::Formatted<'_>) -> Result {
         fn write_bytes(buf: &mut dyn Write, s: &[u8]) -> Result {
             buf.write_str(unsafe { str::from_utf8_unchecked(s) })
         }
@@ -1453,7 +1453,7 @@ impl<'a> Formatter<'a> {
     /// assert_eq!(&format!("{:0>8}", Foo(2)), "Foo 2");
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
-    pub fn write_fmt(&mut self, fmt: Arguments) -> Result {
+    pub fn write_fmt(&mut self, fmt: Arguments<'_>) -> Result {
         write(self.buf, fmt)
     }
 
@@ -1892,14 +1892,14 @@ impl Write for Formatter<'_> {
         self.buf.write_char(c)
     }
 
-    fn write_fmt(&mut self, args: Arguments) -> Result {
+    fn write_fmt(&mut self, args: Arguments<'_>) -> Result {
         write(self.buf, args)
     }
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
 impl Display for Error {
-    fn fmt(&self, f: &mut Formatter) -> Result {
+    fn fmt(&self, f: &mut Formatter<'_>) -> Result {
         Display::fmt("an error occurred when formatting an argument", f)
     }
 }
@@ -1911,11 +1911,11 @@ macro_rules! fmt_refs {
         $(
         #[stable(feature = "rust1", since = "1.0.0")]
         impl<T: ?Sized + $tr> $tr for &T {
-            fn fmt(&self, f: &mut Formatter) -> Result { $tr::fmt(&**self, f) }
+            fn fmt(&self, f: &mut Formatter<'_>) -> Result { $tr::fmt(&**self, f) }
         }
         #[stable(feature = "rust1", since = "1.0.0")]
         impl<T: ?Sized + $tr> $tr for &mut T {
-            fn fmt(&self, f: &mut Formatter) -> Result { $tr::fmt(&**self, f) }
+            fn fmt(&self, f: &mut Formatter<'_>) -> Result { $tr::fmt(&**self, f) }
         }
         )*
     }
@@ -1925,14 +1925,14 @@ fmt_refs! { Debug, Display, Octal, Binary, LowerHex, UpperHex, LowerExp, UpperEx
 
 #[unstable(feature = "never_type", issue = "35121")]
 impl Debug for ! {
-    fn fmt(&self, _: &mut Formatter) -> Result {
+    fn fmt(&self, _: &mut Formatter<'_>) -> Result {
         *self
     }
 }
 
 #[unstable(feature = "never_type", issue = "35121")]
 impl Display for ! {
-    fn fmt(&self, _: &mut Formatter) -> Result {
+    fn fmt(&self, _: &mut Formatter<'_>) -> Result {
         *self
     }
 }
@@ -1940,21 +1940,21 @@ impl Display for ! {
 #[stable(feature = "rust1", since = "1.0.0")]
 impl Debug for bool {
     #[inline]
-    fn fmt(&self, f: &mut Formatter) -> Result {
+    fn fmt(&self, f: &mut Formatter<'_>) -> Result {
         Display::fmt(self, f)
     }
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
 impl Display for bool {
-    fn fmt(&self, f: &mut Formatter) -> Result {
+    fn fmt(&self, f: &mut Formatter<'_>) -> Result {
         Display::fmt(if *self { "true" } else { "false" }, f)
     }
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
 impl Debug for str {
-    fn fmt(&self, f: &mut Formatter) -> Result {
+    fn fmt(&self, f: &mut Formatter<'_>) -> Result {
         f.write_char('"')?;
         let mut from = 0;
         for (i, c) in self.char_indices() {
@@ -1975,14 +1975,14 @@ impl Debug for str {
 
 #[stable(feature = "rust1", since = "1.0.0")]
 impl Display for str {
-    fn fmt(&self, f: &mut Formatter) -> Result {
+    fn fmt(&self, f: &mut Formatter<'_>) -> Result {
         f.pad(self)
     }
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
 impl Debug for char {
-    fn fmt(&self, f: &mut Formatter) -> Result {
+    fn fmt(&self, f: &mut Formatter<'_>) -> Result {
         f.write_char('\'')?;
         for c in self.escape_debug() {
             f.write_char(c)?
@@ -1993,7 +1993,7 @@ impl Debug for char {
 
 #[stable(feature = "rust1", since = "1.0.0")]
 impl Display for char {
-    fn fmt(&self, f: &mut Formatter) -> Result {
+    fn fmt(&self, f: &mut Formatter<'_>) -> Result {
         if f.width.is_none() && f.precision.is_none() {
             f.write_char(*self)
         } else {
@@ -2004,7 +2004,7 @@ impl Display for char {
 
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<T: ?Sized> Pointer for *const T {
-    fn fmt(&self, f: &mut Formatter) -> Result {
+    fn fmt(&self, f: &mut Formatter<'_>) -> Result {
         let old_width = f.width;
         let old_flags = f.flags;
 
@@ -2032,21 +2032,21 @@ impl<T: ?Sized> Pointer for *const T {
 
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<T: ?Sized> Pointer for *mut T {
-    fn fmt(&self, f: &mut Formatter) -> Result {
+    fn fmt(&self, f: &mut Formatter<'_>) -> Result {
         Pointer::fmt(&(*self as *const T), f)
     }
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<T: ?Sized> Pointer for &T {
-    fn fmt(&self, f: &mut Formatter) -> Result {
+    fn fmt(&self, f: &mut Formatter<'_>) -> Result {
         Pointer::fmt(&(*self as *const T), f)
     }
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<T: ?Sized> Pointer for &mut T {
-    fn fmt(&self, f: &mut Formatter) -> Result {
+    fn fmt(&self, f: &mut Formatter<'_>) -> Result {
         Pointer::fmt(&(&**self as *const T), f)
     }
 }
@@ -2055,11 +2055,11 @@ impl<T: ?Sized> Pointer for &mut T {
 
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<T: ?Sized> Debug for *const T {
-    fn fmt(&self, f: &mut Formatter) -> Result { Pointer::fmt(self, f) }
+    fn fmt(&self, f: &mut Formatter<'_>) -> Result { Pointer::fmt(self, f) }
 }
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<T: ?Sized> Debug for *mut T {
-    fn fmt(&self, f: &mut Formatter) -> Result { Pointer::fmt(self, f) }
+    fn fmt(&self, f: &mut Formatter<'_>) -> Result { Pointer::fmt(self, f) }
 }
 
 macro_rules! peel {
@@ -2072,7 +2072,7 @@ macro_rules! tuple {
         #[stable(feature = "rust1", since = "1.0.0")]
         impl<$($name:Debug),*> Debug for ($($name,)*) where last_type!($($name,)+): ?Sized {
             #[allow(non_snake_case, unused_assignments)]
-            fn fmt(&self, f: &mut Formatter) -> Result {
+            fn fmt(&self, f: &mut Formatter<'_>) -> Result {
                 let mut builder = f.debug_tuple("");
                 let ($(ref $name,)*) = *self;
                 $(
@@ -2095,7 +2095,7 @@ tuple! { T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, }
 
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<T: Debug> Debug for [T] {
-    fn fmt(&self, f: &mut Formatter) -> Result {
+    fn fmt(&self, f: &mut Formatter<'_>) -> Result {
         f.debug_list().entries(self.iter()).finish()
     }
 }
@@ -2103,20 +2103,20 @@ impl<T: Debug> Debug for [T] {
 #[stable(feature = "rust1", since = "1.0.0")]
 impl Debug for () {
     #[inline]
-    fn fmt(&self, f: &mut Formatter) -> Result {
+    fn fmt(&self, f: &mut Formatter<'_>) -> Result {
         f.pad("()")
     }
 }
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<T: ?Sized> Debug for PhantomData<T> {
-    fn fmt(&self, f: &mut Formatter) -> Result {
+    fn fmt(&self, f: &mut Formatter<'_>) -> Result {
         f.pad("PhantomData")
     }
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<T: Copy + Debug> Debug for Cell<T> {
-    fn fmt(&self, f: &mut Formatter) -> Result {
+    fn fmt(&self, f: &mut Formatter<'_>) -> Result {
         f.debug_struct("Cell")
             .field("value", &self.get())
             .finish()
@@ -2125,7 +2125,7 @@ impl<T: Copy + Debug> Debug for Cell<T> {
 
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<T: ?Sized + Debug> Debug for RefCell<T> {
-    fn fmt(&self, f: &mut Formatter) -> Result {
+    fn fmt(&self, f: &mut Formatter<'_>) -> Result {
         match self.try_borrow() {
             Ok(borrow) => {
                 f.debug_struct("RefCell")
@@ -2138,7 +2138,7 @@ impl<T: ?Sized + Debug> Debug for RefCell<T> {
                 struct BorrowedPlaceholder;
 
                 impl Debug for BorrowedPlaceholder {
-                    fn fmt(&self, f: &mut Formatter) -> Result {
+                    fn fmt(&self, f: &mut Formatter<'_>) -> Result {
                         f.write_str("<borrowed>")
                     }
                 }
@@ -2153,21 +2153,21 @@ impl<T: ?Sized + Debug> Debug for RefCell<T> {
 
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<T: ?Sized + Debug> Debug for Ref<'_, T> {
-    fn fmt(&self, f: &mut Formatter) -> Result {
+    fn fmt(&self, f: &mut Formatter<'_>) -> Result {
         Debug::fmt(&**self, f)
     }
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<T: ?Sized + Debug> Debug for RefMut<'_, T> {
-    fn fmt(&self, f: &mut Formatter) -> Result {
+    fn fmt(&self, f: &mut Formatter<'_>) -> Result {
         Debug::fmt(&*(self.deref()), f)
     }
 }
 
 #[stable(feature = "core_impl_debug", since = "1.9.0")]
 impl<T: ?Sized + Debug> Debug for UnsafeCell<T> {
-    fn fmt(&self, f: &mut Formatter) -> Result {
+    fn fmt(&self, f: &mut Formatter<'_>) -> Result {
         f.pad("UnsafeCell")
     }
 }
diff --git a/src/libcore/fmt/num.rs b/src/libcore/fmt/num.rs
index 6ad9cc62239..f9b4c26496c 100644
--- a/src/libcore/fmt/num.rs
+++ b/src/libcore/fmt/num.rs
@@ -46,7 +46,7 @@ trait GenericRadix {
     fn digit(x: u8) -> u8;
 
     /// Format an integer using the radix using a formatter.
-    fn fmt_int<T: Int>(&self, mut x: T, f: &mut fmt::Formatter) -> fmt::Result {
+    fn fmt_int<T: Int>(&self, mut x: T, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         // The radix can be as low as 2, so we need a buffer of at least 128
         // characters for a base 2 number.
         let zero = T::zero();
@@ -131,7 +131,7 @@ macro_rules! int_base {
     ($Trait:ident for $T:ident as $U:ident -> $Radix:ident) => {
         #[stable(feature = "rust1", since = "1.0.0")]
         impl fmt::$Trait for $T {
-            fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+            fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
                 $Radix.fmt_int(*self as $U, f)
             }
         }
@@ -143,7 +143,7 @@ macro_rules! debug {
         #[stable(feature = "rust1", since = "1.0.0")]
         impl fmt::Debug for $T {
             #[inline]
-            fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+            fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
                 if f.debug_lower_hex() {
                     fmt::LowerHex::fmt(self, f)
                 } else if f.debug_upper_hex() {
@@ -188,7 +188,7 @@ static DEC_DIGITS_LUT: &[u8; 200] =
 
 macro_rules! impl_Display {
     ($($t:ident),* as $u:ident via $conv_fn:ident named $name:ident) => {
-        fn $name(mut n: $u, is_nonnegative: bool, f: &mut fmt::Formatter) -> fmt::Result {
+        fn $name(mut n: $u, is_nonnegative: bool, f: &mut fmt::Formatter<'_>) -> fmt::Result {
             let mut buf = uninitialized_array![u8; 39];
             let mut curr = buf.len() as isize;
             let buf_ptr = MaybeUninit::first_ptr_mut(&mut buf);
@@ -243,7 +243,7 @@ macro_rules! impl_Display {
             #[stable(feature = "rust1", since = "1.0.0")]
             impl fmt::Display for $t {
                 #[allow(unused_comparisons)]
-                fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+                fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
                     let is_nonnegative = *self >= 0;
                     let n = if is_nonnegative {
                         self.$conv_fn()