diff --git a/src/libcore/alloc.rs b/src/libcore/alloc.rs index 18354945a1e51..c124457118cb9 100644 --- a/src/libcore/alloc.rs +++ b/src/libcore/alloc.rs @@ -338,7 +338,7 @@ pub struct LayoutErr { // (we need this for downstream impl of trait Error) #[stable(feature = "alloc_layout", since = "1.28.0")] impl fmt::Display for LayoutErr { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.write_str("invalid parameters to Layout::from_size_align") } } @@ -354,7 +354,7 @@ pub struct AllocErr; // (we need this for downstream impl of trait Error) #[unstable(feature = "allocator_api", issue = "32838")] impl fmt::Display for AllocErr { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.write_str("memory allocation failed") } } @@ -376,7 +376,7 @@ impl CannotReallocInPlace { // (we need this for downstream impl of trait Error) #[unstable(feature = "allocator_api", issue = "32838")] impl fmt::Display for CannotReallocInPlace { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "{}", self.description()) } } diff --git a/src/libcore/any.rs b/src/libcore/any.rs index a4827aa36edd0..d043ce34effcd 100644 --- a/src/libcore/any.rs +++ b/src/libcore/any.rs @@ -107,7 +107,7 @@ impl Any for T { #[stable(feature = "rust1", since = "1.0.0")] impl fmt::Debug for dyn Any { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.pad("Any") } } @@ -117,14 +117,14 @@ impl fmt::Debug for dyn Any { // dispatch works with upcasting. #[stable(feature = "rust1", since = "1.0.0")] impl fmt::Debug for dyn Any + Send { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.pad("Any") } } #[stable(feature = "any_send_sync_methods", since = "1.28.0")] impl fmt::Debug for dyn Any + Send + Sync { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.pad("Any") } } diff --git a/src/libcore/array.rs b/src/libcore/array.rs index 3c445db69bbb4..fb9c99f667df2 100644 --- a/src/libcore/array.rs +++ b/src/libcore/array.rs @@ -55,7 +55,7 @@ pub struct TryFromSliceError(()); impl fmt::Display for TryFromSliceError { #[inline] - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fmt::Display::fmt(self.__description(), f) } } @@ -184,7 +184,7 @@ macro_rules! array_impls { #[stable(feature = "rust1", since = "1.0.0")] impl fmt::Debug for [T; $N] { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fmt::Debug::fmt(&&self[..], f) } } diff --git a/src/libcore/ascii.rs b/src/libcore/ascii.rs index 953fe9ca2b9f8..c0ab364380fbd 100644 --- a/src/libcore/ascii.rs +++ b/src/libcore/ascii.rs @@ -131,7 +131,7 @@ impl FusedIterator for EscapeDefault {} #[stable(feature = "std_debug", since = "1.16.0")] impl fmt::Debug for EscapeDefault { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.pad("EscapeDefault { .. }") } } diff --git a/src/libcore/cell.rs b/src/libcore/cell.rs index 1c55e62539a85..fcfd80d92660d 100644 --- a/src/libcore/cell.rs +++ b/src/libcore/cell.rs @@ -577,14 +577,14 @@ pub struct BorrowError { #[stable(feature = "try_borrow", since = "1.13.0")] impl Debug for BorrowError { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.debug_struct("BorrowError").finish() } } #[stable(feature = "try_borrow", since = "1.13.0")] impl Display for BorrowError { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { Display::fmt("already mutably borrowed", f) } } @@ -597,14 +597,14 @@ pub struct BorrowMutError { #[stable(feature = "try_borrow", since = "1.13.0")] impl Debug for BorrowMutError { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.debug_struct("BorrowMutError").finish() } } #[stable(feature = "try_borrow", since = "1.13.0")] impl Display for BorrowMutError { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { Display::fmt("already borrowed", f) } } @@ -788,7 +788,7 @@ impl RefCell { /// ``` #[stable(feature = "rust1", since = "1.0.0")] #[inline] - pub fn borrow(&self) -> Ref { + pub fn borrow(&self) -> Ref<'_, T> { self.try_borrow().expect("already mutably borrowed") } @@ -819,7 +819,7 @@ impl RefCell { /// ``` #[stable(feature = "try_borrow", since = "1.13.0")] #[inline] - pub fn try_borrow(&self) -> Result, BorrowError> { + pub fn try_borrow(&self) -> Result, BorrowError> { match BorrowRef::new(&self.borrow) { Some(b) => Ok(Ref { value: unsafe { &*self.value.get() }, @@ -869,7 +869,7 @@ impl RefCell { /// ``` #[stable(feature = "rust1", since = "1.0.0")] #[inline] - pub fn borrow_mut(&self) -> RefMut { + pub fn borrow_mut(&self) -> RefMut<'_, T> { self.try_borrow_mut().expect("already borrowed") } @@ -897,7 +897,7 @@ impl RefCell { /// ``` #[stable(feature = "try_borrow", since = "1.13.0")] #[inline] - pub fn try_borrow_mut(&self) -> Result, BorrowMutError> { + pub fn try_borrow_mut(&self) -> Result, BorrowMutError> { match BorrowRefMut::new(&self.borrow) { Some(b) => Ok(RefMut { value: unsafe { &mut *self.value.get() }, @@ -1245,7 +1245,7 @@ impl<'b, T: ?Sized + Unsize, U: ?Sized> CoerceUnsized> for Ref<'b, #[stable(feature = "std_guard_impls", since = "1.20.0")] impl fmt::Display for Ref<'_, T> { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { self.value.fmt(f) } } @@ -1402,7 +1402,7 @@ impl<'b, T: ?Sized + Unsize, U: ?Sized> CoerceUnsized> for RefM #[stable(feature = "std_guard_impls", since = "1.20.0")] impl fmt::Display for RefMut<'_, T> { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { self.value.fmt(f) } } diff --git a/src/libcore/char/convert.rs b/src/libcore/char/convert.rs index ec273746111ee..ec9ac7ce8b1cb 100644 --- a/src/libcore/char/convert.rs +++ b/src/libcore/char/convert.rs @@ -193,7 +193,7 @@ enum CharErrorKind { #[stable(feature = "char_from_str", since = "1.20.0")] impl fmt::Display for ParseCharError { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { self.__description().fmt(f) } } @@ -240,7 +240,7 @@ pub struct CharTryFromError(()); #[stable(feature = "try_from", since = "1.34.0")] impl fmt::Display for CharTryFromError { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { "converted integer out of range for `char`".fmt(f) } } @@ -316,4 +316,3 @@ pub fn from_digit(num: u32, radix: u32) -> Option { None } } - diff --git a/src/libcore/char/decode.rs b/src/libcore/char/decode.rs index ed92eca08bf7f..23059243c61d7 100644 --- a/src/libcore/char/decode.rs +++ b/src/libcore/char/decode.rs @@ -128,7 +128,7 @@ impl DecodeUtf16Error { #[stable(feature = "decode_utf16", since = "1.9.0")] impl fmt::Display for DecodeUtf16Error { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "unpaired surrogate found: {:x}", self.code) } } diff --git a/src/libcore/char/mod.rs b/src/libcore/char/mod.rs index 39186273d62db..dedd2f758b6cb 100644 --- a/src/libcore/char/mod.rs +++ b/src/libcore/char/mod.rs @@ -220,7 +220,7 @@ impl FusedIterator for EscapeUnicode {} #[stable(feature = "char_struct_display", since = "1.16.0")] impl fmt::Display for EscapeUnicode { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { for c in self.clone() { f.write_char(c)?; } @@ -333,7 +333,7 @@ impl FusedIterator for EscapeDefault {} #[stable(feature = "char_struct_display", since = "1.16.0")] impl fmt::Display for EscapeDefault { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { for c in self.clone() { f.write_char(c)?; } @@ -367,7 +367,7 @@ impl FusedIterator for EscapeDebug {} #[stable(feature = "char_escape_debug", since = "1.20.0")] impl fmt::Display for EscapeDebug { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fmt::Display::fmt(&self.0, f) } } @@ -482,7 +482,7 @@ impl Iterator for CaseMappingIter { } impl fmt::Display for CaseMappingIter { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match *self { CaseMappingIter::Three(a, b, c) => { f.write_char(a)?; @@ -503,14 +503,14 @@ impl fmt::Display for CaseMappingIter { #[stable(feature = "char_struct_display", since = "1.16.0")] impl fmt::Display for ToLowercase { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fmt::Display::fmt(&self.0, f) } } #[stable(feature = "char_struct_display", since = "1.16.0")] impl fmt::Display for ToUppercase { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fmt::Display::fmt(&self.0, f) } } diff --git a/src/libcore/ffi.rs b/src/libcore/ffi.rs index 004fafc5a0b65..2906e5824ae70 100644 --- a/src/libcore/ffi.rs +++ b/src/libcore/ffi.rs @@ -39,7 +39,7 @@ pub enum c_void { #[stable(feature = "std_debug", since = "1.16.0")] impl fmt::Debug for c_void { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.pad("c_void") } } @@ -62,7 +62,7 @@ extern { all(target_arch = "aarch64", target_os = "ios"), windows))] impl fmt::Debug for VaListImpl { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "va_list* {:p}", self) } } @@ -212,7 +212,7 @@ impl<'a> VaList<'a> { extern "rust-intrinsic" { /// Destroy the arglist `ap` after initialization with `va_start` or /// `va_copy`. - fn va_end(ap: &mut VaList); + fn va_end(ap: &mut VaList<'_>); /// Copies the current location of arglist `src` to the arglist `dst`. #[cfg(any(all(not(target_arch = "aarch64"), not(target_arch = "powerpc"), @@ -222,9 +222,9 @@ extern "rust-intrinsic" { fn va_copy<'a>(src: &VaList<'a>) -> VaList<'a>; #[cfg(all(any(target_arch = "aarch64", target_arch = "powerpc", target_arch = "x86_64"), not(windows), not(all(target_arch = "aarch64", target_os = "ios"))))] - fn va_copy(src: &VaList) -> VaListImpl; + fn va_copy(src: &VaList<'_>) -> VaListImpl; /// Loads an argument of type `T` from the `va_list` `ap` and increment the /// argument `ap` points to. - fn va_arg(ap: &mut VaList) -> T; + fn va_arg(ap: &mut VaList<'_>) -> T; } diff --git a/src/libcore/fmt/builders.rs b/src/libcore/fmt/builders.rs index e78381ba0c482..df86da5fc3906 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) + fn wrap<'b, 'c: 'a+'b>(fmt: &'c mut fmt::Formatter<'_>, slot: &'b mut Option) -> 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 5fc2cd4b8d0a3..4bd7d3b4b22e3 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(fmt: &mut Formatter, num: &T, +fn float_to_decimal_common_exact(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(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(fmt: &mut Formatter, num: &T, +fn float_to_decimal_common_shortest(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(fmt: &mut Formatter, num: &T, } // Common code of floating point Debug and Display. -fn float_to_decimal_common(fmt: &mut Formatter, num: &T, +fn float_to_decimal_common(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(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(fmt: &mut Formatter, num: &T, +fn float_to_exponential_common_exact(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(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(fmt: &mut Formatter, +fn float_to_exponential_common_shortest(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(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(fmt: &mut Formatter, } // Common code of floating point LowerExp and UpperExp. -fn float_to_exponential_common(fmt: &mut Formatter, num: &T, upper: bool) -> Result +fn float_to_exponential_common(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 1ccd6ec898f8b..43c1a3b7767ab 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 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, prefix: Option<&str>) -> Result { + fn write_prefix(f: &mut Formatter<'_>, sign: Option, 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 $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 $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 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 Pointer for *const T { #[stable(feature = "rust1", since = "1.0.0")] impl 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 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 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 Pointer for &mut T { #[stable(feature = "rust1", since = "1.0.0")] impl 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 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 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 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 Debug for PhantomData { - 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 Debug for Cell { - 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 Debug for Cell { #[stable(feature = "rust1", since = "1.0.0")] impl Debug for RefCell { - 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 Debug for RefCell { struct BorrowedPlaceholder; impl Debug for BorrowedPlaceholder { - fn fmt(&self, f: &mut Formatter) -> Result { + fn fmt(&self, f: &mut Formatter<'_>) -> Result { f.write_str("") } } @@ -2153,21 +2153,21 @@ impl Debug for RefCell { #[stable(feature = "rust1", since = "1.0.0")] impl 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 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 Debug for UnsafeCell { - 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 6ad9cc6223953..f9b4c26496cdc 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(&self, mut x: T, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt_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() diff --git a/src/libcore/hash/mod.rs b/src/libcore/hash/mod.rs index 46f7f90e4649d..98150fd9f821e 100644 --- a/src/libcore/hash/mod.rs +++ b/src/libcore/hash/mod.rs @@ -500,7 +500,7 @@ pub struct BuildHasherDefault(marker::PhantomData); #[stable(since = "1.9.0", feature = "core_impl_debug")] impl fmt::Debug for BuildHasherDefault { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.pad("BuildHasherDefault") } } diff --git a/src/libcore/iter/adapters/flatten.rs b/src/libcore/iter/adapters/flatten.rs index 8eb81fbb2c6e4..8c2aae477bf2a 100644 --- a/src/libcore/iter/adapters/flatten.rs +++ b/src/libcore/iter/adapters/flatten.rs @@ -34,7 +34,7 @@ impl Clone for FlatMap impl fmt::Debug for FlatMap where U::IntoIter: fmt::Debug { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.debug_struct("FlatMap").field("inner", &self.inner).finish() } } @@ -120,7 +120,7 @@ impl fmt::Debug for Flatten where I: Iterator + fmt::Debug, U: Iterator + fmt::Debug, I::Item: IntoIterator, { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.debug_struct("Flatten").field("inner", &self.inner).finish() } } @@ -328,4 +328,3 @@ impl DoubleEndedIterator for FlattenCompat .rfold(init, |acc, iter| iter.rfold(acc, &mut fold)) } } - diff --git a/src/libcore/iter/adapters/mod.rs b/src/libcore/iter/adapters/mod.rs index ce18b4b97ad66..61e6ab6b48a3f 100644 --- a/src/libcore/iter/adapters/mod.rs +++ b/src/libcore/iter/adapters/mod.rs @@ -553,7 +553,7 @@ impl Map { #[stable(feature = "core_impl_debug", since = "1.9.0")] impl fmt::Debug for Map { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.debug_struct("Map") .field("iter", &self.iter) .finish() @@ -669,7 +669,7 @@ impl Filter { #[stable(feature = "core_impl_debug", since = "1.9.0")] impl fmt::Debug for Filter { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.debug_struct("Filter") .field("iter", &self.iter) .finish() @@ -793,7 +793,7 @@ impl FilterMap { #[stable(feature = "core_impl_debug", since = "1.9.0")] impl fmt::Debug for FilterMap { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.debug_struct("FilterMap") .field("iter", &self.iter) .finish() @@ -1222,7 +1222,7 @@ impl SkipWhile { #[stable(feature = "core_impl_debug", since = "1.9.0")] impl fmt::Debug for SkipWhile { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.debug_struct("SkipWhile") .field("iter", &self.iter) .field("flag", &self.flag) @@ -1310,7 +1310,7 @@ impl TakeWhile { #[stable(feature = "core_impl_debug", since = "1.9.0")] impl fmt::Debug for TakeWhile { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.debug_struct("TakeWhile") .field("iter", &self.iter) .field("flag", &self.flag) @@ -1634,7 +1634,7 @@ impl Scan { #[stable(feature = "core_impl_debug", since = "1.9.0")] impl fmt::Debug for Scan { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.debug_struct("Scan") .field("iter", &self.iter) .field("state", &self.state) @@ -1928,7 +1928,7 @@ impl Inspect { #[stable(feature = "core_impl_debug", since = "1.9.0")] impl fmt::Debug for Inspect { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.debug_struct("Inspect") .field("iter", &self.iter) .finish() diff --git a/src/libcore/iter/sources.rs b/src/libcore/iter/sources.rs index c4f6fbf0ff222..70a3b70c180dc 100644 --- a/src/libcore/iter/sources.rs +++ b/src/libcore/iter/sources.rs @@ -200,7 +200,7 @@ pub struct Empty(marker::PhantomData); #[stable(feature = "core_impl_debug", since = "1.9.0")] impl fmt::Debug for Empty { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.pad("Empty") } } @@ -558,7 +558,7 @@ impl Iterator for FromFn #[stable(feature = "iter_from_fn", since = "1.34.0")] impl fmt::Debug for FromFn { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.debug_struct("FromFn").finish() } } @@ -631,7 +631,7 @@ impl FusedIterator for Successors #[stable(feature = "iter_successors", since = "1.34.0")] impl fmt::Debug for Successors { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.debug_struct("Successors") .field("next", &self.next) .finish() diff --git a/src/libcore/lib.rs b/src/libcore/lib.rs index 0d660b002da60..28db55578c3de 100644 --- a/src/libcore/lib.rs +++ b/src/libcore/lib.rs @@ -65,7 +65,6 @@ #![deny(rust_2018_idioms)] #![allow(explicit_outlives_requirements)] -#![allow(elided_lifetimes_in_paths)] #![feature(allow_internal_unstable)] #![feature(arbitrary_self_types)] diff --git a/src/libcore/mem.rs b/src/libcore/mem.rs index e2bd4b4a39a9d..95480c6bf048d 100644 --- a/src/libcore/mem.rs +++ b/src/libcore/mem.rs @@ -862,7 +862,7 @@ impl hash::Hash for Discriminant { #[stable(feature = "discriminant_value", since = "1.21.0")] impl fmt::Debug for Discriminant { - fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { fmt.debug_tuple("Discriminant") .field(&self.0) .finish() diff --git a/src/libcore/num/bignum.rs b/src/libcore/num/bignum.rs index 64699e85d0c88..342ac69748d92 100644 --- a/src/libcore/num/bignum.rs +++ b/src/libcore/num/bignum.rs @@ -459,7 +459,7 @@ macro_rules! define_bignum { } impl crate::fmt::Debug for $name { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + fn fmt(&self, f: &mut crate::fmt::Formatter<'_>) -> crate::fmt::Result { use crate::mem; let sz = if self.size < 1 {1} else {self.size}; diff --git a/src/libcore/num/dec2flt/mod.rs b/src/libcore/num/dec2flt/mod.rs index dcfa2d352a818..4536bbc94ad80 100644 --- a/src/libcore/num/dec2flt/mod.rs +++ b/src/libcore/num/dec2flt/mod.rs @@ -196,7 +196,7 @@ impl ParseFloatError { #[stable(feature = "rust1", since = "1.0.0")] impl fmt::Display for ParseFloatError { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { self.__description().fmt(f) } } @@ -244,7 +244,7 @@ fn dec2flt(s: &str) -> Result { /// The main workhorse for the decimal-to-float conversion: Orchestrate all the preprocessing /// and figure out which algorithm should do the actual conversion. -fn convert(mut decimal: Decimal) -> Result { +fn convert(mut decimal: Decimal<'_>) -> Result { simplify(&mut decimal); if let Some(x) = trivial_cases(&decimal) { return Ok(x); @@ -281,7 +281,7 @@ fn convert(mut decimal: Decimal) -> Result { /// Strip zeros where possible, even when this requires changing the exponent #[inline(always)] -fn simplify(decimal: &mut Decimal) { +fn simplify(decimal: &mut Decimal<'_>) { let is_zero = &|&&d: &&u8| -> bool { d == b'0' }; // Trimming these zeros does not change anything but may enable the fast path (< 15 digits). let leading_zeros = decimal.integral.iter().take_while(is_zero).count(); @@ -306,7 +306,7 @@ fn simplify(decimal: &mut Decimal) { /// Returns a quick-an-dirty upper bound on the size (log10) of the largest value that Algorithm R /// and Algorithm M will compute while working on the given decimal. -fn bound_intermediate_digits(decimal: &Decimal, e: i64) -> u64 { +fn bound_intermediate_digits(decimal: &Decimal<'_>, e: i64) -> u64 { // We don't need to worry too much about overflow here thanks to trivial_cases() and the // parser, which filter out the most extreme inputs for us. let f_len: u64 = decimal.integral.len() as u64 + decimal.fractional.len() as u64; @@ -325,7 +325,7 @@ fn bound_intermediate_digits(decimal: &Decimal, e: i64) -> u64 { } /// Detects obvious overflows and underflows without even looking at the decimal digits. -fn trivial_cases(decimal: &Decimal) -> Option { +fn trivial_cases(decimal: &Decimal<'_>) -> Option { // There were zeros but they were stripped by simplify() if decimal.integral.is_empty() && decimal.fractional.is_empty() { return Some(T::ZERO); diff --git a/src/libcore/num/dec2flt/parse.rs b/src/libcore/num/dec2flt/parse.rs index f970595452ec9..cf3664a874886 100644 --- a/src/libcore/num/dec2flt/parse.rs +++ b/src/libcore/num/dec2flt/parse.rs @@ -44,7 +44,7 @@ pub enum ParseResult<'a> { /// Checks if the input string is a valid floating point number and if so, locate the integral /// part, the fractional part, and the exponent in it. Does not handle signs. -pub fn parse_decimal(s: &str) -> ParseResult { +pub fn parse_decimal(s: &str) -> ParseResult<'_> { if s.is_empty() { return Invalid; } diff --git a/src/libcore/num/mod.rs b/src/libcore/num/mod.rs index 24afc945e9313..c8a4ff7ca61e7 100644 --- a/src/libcore/num/mod.rs +++ b/src/libcore/num/mod.rs @@ -15,7 +15,7 @@ macro_rules! impl_nonzero_fmt { #[$stability] impl fmt::$Trait for $Ty { #[inline] - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { self.get().fmt(f) } } @@ -164,42 +164,42 @@ pub struct Wrapping(#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")] impl fmt::Debug for Wrapping { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { self.0.fmt(f) } } #[stable(feature = "wrapping_display", since = "1.10.0")] impl fmt::Display for Wrapping { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { self.0.fmt(f) } } #[stable(feature = "wrapping_fmt", since = "1.11.0")] impl fmt::Binary for Wrapping { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { self.0.fmt(f) } } #[stable(feature = "wrapping_fmt", since = "1.11.0")] impl fmt::Octal for Wrapping { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { self.0.fmt(f) } } #[stable(feature = "wrapping_fmt", since = "1.11.0")] impl fmt::LowerHex for Wrapping { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { self.0.fmt(f) } } #[stable(feature = "wrapping_fmt", since = "1.11.0")] impl fmt::UpperHex for Wrapping { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { self.0.fmt(f) } } @@ -4423,7 +4423,7 @@ impl TryFromIntError { #[stable(feature = "try_from", since = "1.34.0")] impl fmt::Display for TryFromIntError { - fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { self.__description().fmt(fmt) } } @@ -4820,7 +4820,7 @@ impl ParseIntError { #[stable(feature = "rust1", since = "1.0.0")] impl fmt::Display for ParseIntError { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { self.__description().fmt(f) } } diff --git a/src/libcore/ops/range.rs b/src/libcore/ops/range.rs index e13df04c2cedd..a707f0cc0627a 100644 --- a/src/libcore/ops/range.rs +++ b/src/libcore/ops/range.rs @@ -45,7 +45,7 @@ pub struct RangeFull; #[stable(feature = "rust1", since = "1.0.0")] impl fmt::Debug for RangeFull { - fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { write!(fmt, "..") } } @@ -84,7 +84,7 @@ pub struct Range { #[stable(feature = "rust1", since = "1.0.0")] impl fmt::Debug for Range { - fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { self.start.fmt(fmt)?; write!(fmt, "..")?; self.end.fmt(fmt)?; @@ -186,7 +186,7 @@ pub struct RangeFrom { #[stable(feature = "rust1", since = "1.0.0")] impl fmt::Debug for RangeFrom { - fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { self.start.fmt(fmt)?; write!(fmt, "..")?; Ok(()) @@ -270,7 +270,7 @@ pub struct RangeTo { #[stable(feature = "rust1", since = "1.0.0")] impl fmt::Debug for RangeTo { - fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { write!(fmt, "..")?; self.end.fmt(fmt)?; Ok(()) @@ -473,7 +473,7 @@ impl RangeInclusive { #[stable(feature = "inclusive_range", since = "1.26.0")] impl fmt::Debug for RangeInclusive { - fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { self.start.fmt(fmt)?; write!(fmt, "..=")?; self.end.fmt(fmt)?; @@ -611,7 +611,7 @@ pub struct RangeToInclusive { #[stable(feature = "inclusive_range", since = "1.26.0")] impl fmt::Debug for RangeToInclusive { - fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { write!(fmt, "..=")?; self.end.fmt(fmt)?; Ok(()) diff --git a/src/libcore/option.rs b/src/libcore/option.rs index 7ce9a73a78205..9599491462e92 100644 --- a/src/libcore/option.rs +++ b/src/libcore/option.rs @@ -538,7 +538,7 @@ impl Option { /// ``` #[inline] #[stable(feature = "rust1", since = "1.0.0")] - pub fn iter(&self) -> Iter { + pub fn iter(&self) -> Iter<'_, T> { Iter { inner: Item { opt: self.as_ref() } } } @@ -559,7 +559,7 @@ impl Option { /// ``` #[inline] #[stable(feature = "rust1", since = "1.0.0")] - pub fn iter_mut(&mut self) -> IterMut { + pub fn iter_mut(&mut self) -> IterMut<'_, T> { IterMut { inner: Item { opt: self.as_mut() } } } diff --git a/src/libcore/panic.rs b/src/libcore/panic.rs index bcb87bdd098fc..989fc96732a5a 100644 --- a/src/libcore/panic.rs +++ b/src/libcore/panic.rs @@ -86,7 +86,7 @@ impl<'a> PanicInfo<'a> { /// /// [`fmt::write`]: ../fmt/fn.write.html #[unstable(feature = "panic_info_message", issue = "44489")] - pub fn message(&self) -> Option<&fmt::Arguments> { + pub fn message(&self) -> Option<&fmt::Arguments<'_>> { self.message } @@ -115,7 +115,7 @@ impl<'a> PanicInfo<'a> { /// panic!("Normal panic"); /// ``` #[stable(feature = "panic_hooks", since = "1.10.0")] - pub fn location(&self) -> Option<&Location> { + pub fn location(&self) -> Option<&Location<'_>> { // NOTE: If this is changed to sometimes return None, // deal with that case in std::panicking::default_hook and std::panicking::begin_panic_fmt. Some(&self.location) @@ -124,7 +124,7 @@ impl<'a> PanicInfo<'a> { #[stable(feature = "panic_hook_display", since = "1.26.0")] impl fmt::Display for PanicInfo<'_> { - fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result { formatter.write_str("panicked at ")?; if let Some(message) = self.message { write!(formatter, "'{}', ", message)? @@ -249,7 +249,7 @@ impl<'a> Location<'a> { #[stable(feature = "panic_hook_display", since = "1.26.0")] impl fmt::Display for Location<'_> { - fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result { write!(formatter, "{}:{}:{}", self.file, self.line, self.col) } } diff --git a/src/libcore/panicking.rs b/src/libcore/panicking.rs index 4b991b8792576..15b7d69c58d24 100644 --- a/src/libcore/panicking.rs +++ b/src/libcore/panicking.rs @@ -65,7 +65,7 @@ fn panic_bounds_check(file_line_col: &(&'static str, u32, u32), #[cold] #[cfg_attr(not(feature="panic_immediate_abort"),inline(never))] #[cfg_attr( feature="panic_immediate_abort" ,inline)] -pub fn panic_fmt(fmt: fmt::Arguments, file_line_col: &(&'static str, u32, u32)) -> ! { +pub fn panic_fmt(fmt: fmt::Arguments<'_>, file_line_col: &(&'static str, u32, u32)) -> ! { if cfg!(feature = "panic_immediate_abort") { unsafe { super::intrinsics::abort() } } @@ -74,7 +74,7 @@ pub fn panic_fmt(fmt: fmt::Arguments, file_line_col: &(&'static str, u32, u32)) #[allow(improper_ctypes)] // PanicInfo contains a trait object which is not FFI safe extern "Rust" { #[lang = "panic_impl"] - fn panic_impl(pi: &PanicInfo) -> !; + fn panic_impl(pi: &PanicInfo<'_>) -> !; } let (file, line, col) = *file_line_col; diff --git a/src/libcore/pin.rs b/src/libcore/pin.rs index 538e1aa481cfe..dbf3dcf03a3c0 100644 --- a/src/libcore/pin.rs +++ b/src/libcore/pin.rs @@ -602,21 +602,21 @@ impl Receiver for Pin

{} #[stable(feature = "pin", since = "1.33.0")] impl fmt::Debug for Pin

{ - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fmt::Debug::fmt(&self.pointer, f) } } #[stable(feature = "pin", since = "1.33.0")] impl fmt::Display for Pin

{ - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fmt::Display::fmt(&self.pointer, f) } } #[stable(feature = "pin", since = "1.33.0")] impl fmt::Pointer for Pin

{ - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fmt::Pointer::fmt(&self.pointer, f) } } diff --git a/src/libcore/ptr.rs b/src/libcore/ptr.rs index 32dcb5bff3691..f05700a1db285 100644 --- a/src/libcore/ptr.rs +++ b/src/libcore/ptr.rs @@ -2623,14 +2623,14 @@ macro_rules! fnptr_impls_safety_abi { #[stable(feature = "fnptr_impls", since = "1.4.0")] impl fmt::Pointer for $FnTy { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fmt::Pointer::fmt(&(*self as *const ()), f) } } #[stable(feature = "fnptr_impls", since = "1.4.0")] impl fmt::Debug for $FnTy { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fmt::Pointer::fmt(&(*self as *const ()), f) } } @@ -2776,7 +2776,7 @@ pub struct Unique { #[unstable(feature = "ptr_internals", issue = "0")] impl fmt::Debug for Unique { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fmt::Pointer::fmt(&self.as_ptr(), f) } } @@ -2876,7 +2876,7 @@ impl DispatchFromDyn> for Unique where T: Uns #[unstable(feature = "ptr_internals", issue = "0")] impl fmt::Pointer for Unique { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fmt::Pointer::fmt(&self.as_ptr(), f) } } @@ -3049,14 +3049,14 @@ impl DispatchFromDyn> for NonNull where T: U #[stable(feature = "nonnull", since = "1.25.0")] impl fmt::Debug for NonNull { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fmt::Pointer::fmt(&self.as_ptr(), f) } } #[stable(feature = "nonnull", since = "1.25.0")] impl fmt::Pointer for NonNull { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fmt::Pointer::fmt(&self.as_ptr(), f) } } diff --git a/src/libcore/result.rs b/src/libcore/result.rs index 0277e52a9a648..bf8fd63b6446f 100644 --- a/src/libcore/result.rs +++ b/src/libcore/result.rs @@ -544,7 +544,7 @@ impl Result { /// ``` #[inline] #[stable(feature = "rust1", since = "1.0.0")] - pub fn iter(&self) -> Iter { + pub fn iter(&self) -> Iter<'_, T> { Iter { inner: self.as_ref().ok() } } @@ -569,7 +569,7 @@ impl Result { /// ``` #[inline] #[stable(feature = "rust1", since = "1.0.0")] - pub fn iter_mut(&mut self) -> IterMut { + pub fn iter_mut(&mut self) -> IterMut<'_, T> { IterMut { inner: self.as_mut().ok() } } diff --git a/src/libcore/slice/mod.rs b/src/libcore/slice/mod.rs index 44d56c60b7899..21c16e65e4ee4 100644 --- a/src/libcore/slice/mod.rs +++ b/src/libcore/slice/mod.rs @@ -524,7 +524,7 @@ impl [T] { /// ``` #[stable(feature = "rust1", since = "1.0.0")] #[inline] - pub fn iter(&self) -> Iter { + pub fn iter(&self) -> Iter<'_, T> { unsafe { let ptr = self.as_ptr(); assume(!ptr.is_null()); @@ -556,7 +556,7 @@ impl [T] { /// ``` #[stable(feature = "rust1", since = "1.0.0")] #[inline] - pub fn iter_mut(&mut self) -> IterMut { + pub fn iter_mut(&mut self) -> IterMut<'_, T> { unsafe { let ptr = self.as_mut_ptr(); assume(!ptr.is_null()); @@ -603,7 +603,7 @@ impl [T] { /// ``` #[stable(feature = "rust1", since = "1.0.0")] #[inline] - pub fn windows(&self, size: usize) -> Windows { + pub fn windows(&self, size: usize) -> Windows<'_, T> { assert!(size != 0); Windows { v: self, size } } @@ -637,7 +637,7 @@ impl [T] { /// [`rchunks`]: #method.rchunks #[stable(feature = "rust1", since = "1.0.0")] #[inline] - pub fn chunks(&self, chunk_size: usize) -> Chunks { + pub fn chunks(&self, chunk_size: usize) -> Chunks<'_, T> { assert!(chunk_size != 0); Chunks { v: self, chunk_size } } @@ -675,7 +675,7 @@ impl [T] { /// [`rchunks_mut`]: #method.rchunks_mut #[stable(feature = "rust1", since = "1.0.0")] #[inline] - pub fn chunks_mut(&mut self, chunk_size: usize) -> ChunksMut { + pub fn chunks_mut(&mut self, chunk_size: usize) -> ChunksMut<'_, T> { assert!(chunk_size != 0); ChunksMut { v: self, chunk_size } } @@ -712,7 +712,7 @@ impl [T] { /// [`rchunks_exact`]: #method.rchunks_exact #[stable(feature = "chunks_exact", since = "1.31.0")] #[inline] - pub fn chunks_exact(&self, chunk_size: usize) -> ChunksExact { + pub fn chunks_exact(&self, chunk_size: usize) -> ChunksExact<'_, T> { assert!(chunk_size != 0); let rem = self.len() % chunk_size; let len = self.len() - rem; @@ -757,7 +757,7 @@ impl [T] { /// [`rchunks_exact_mut`]: #method.rchunks_exact_mut #[stable(feature = "chunks_exact", since = "1.31.0")] #[inline] - pub fn chunks_exact_mut(&mut self, chunk_size: usize) -> ChunksExactMut { + pub fn chunks_exact_mut(&mut self, chunk_size: usize) -> ChunksExactMut<'_, T> { assert!(chunk_size != 0); let rem = self.len() % chunk_size; let len = self.len() - rem; @@ -794,7 +794,7 @@ impl [T] { /// [`chunks`]: #method.chunks #[stable(feature = "rchunks", since = "1.31.0")] #[inline] - pub fn rchunks(&self, chunk_size: usize) -> RChunks { + pub fn rchunks(&self, chunk_size: usize) -> RChunks<'_, T> { assert!(chunk_size != 0); RChunks { v: self, chunk_size } } @@ -832,7 +832,7 @@ impl [T] { /// [`chunks_mut`]: #method.chunks_mut #[stable(feature = "rchunks", since = "1.31.0")] #[inline] - pub fn rchunks_mut(&mut self, chunk_size: usize) -> RChunksMut { + pub fn rchunks_mut(&mut self, chunk_size: usize) -> RChunksMut<'_, T> { assert!(chunk_size != 0); RChunksMut { v: self, chunk_size } } @@ -871,7 +871,7 @@ impl [T] { /// [`chunks_exact`]: #method.chunks_exact #[stable(feature = "rchunks", since = "1.31.0")] #[inline] - pub fn rchunks_exact(&self, chunk_size: usize) -> RChunksExact { + pub fn rchunks_exact(&self, chunk_size: usize) -> RChunksExact<'_, T> { assert!(chunk_size != 0); let rem = self.len() % chunk_size; let (fst, snd) = self.split_at(rem); @@ -916,7 +916,7 @@ impl [T] { /// [`chunks_exact_mut`]: #method.chunks_exact_mut #[stable(feature = "rchunks", since = "1.31.0")] #[inline] - pub fn rchunks_exact_mut(&mut self, chunk_size: usize) -> RChunksExactMut { + pub fn rchunks_exact_mut(&mut self, chunk_size: usize) -> RChunksExactMut<'_, T> { assert!(chunk_size != 0); let rem = self.len() % chunk_size; let (fst, snd) = self.split_at_mut(rem); @@ -1042,7 +1042,7 @@ impl [T] { /// ``` #[stable(feature = "rust1", since = "1.0.0")] #[inline] - pub fn split(&self, pred: F) -> Split + pub fn split(&self, pred: F) -> Split<'_, T, F> where F: FnMut(&T) -> bool { Split { @@ -1067,7 +1067,7 @@ impl [T] { /// ``` #[stable(feature = "rust1", since = "1.0.0")] #[inline] - pub fn split_mut(&mut self, pred: F) -> SplitMut + pub fn split_mut(&mut self, pred: F) -> SplitMut<'_, T, F> where F: FnMut(&T) -> bool { SplitMut { v: self, pred, finished: false } @@ -1102,7 +1102,7 @@ impl [T] { /// ``` #[stable(feature = "slice_rsplit", since = "1.27.0")] #[inline] - pub fn rsplit(&self, pred: F) -> RSplit + pub fn rsplit(&self, pred: F) -> RSplit<'_, T, F> where F: FnMut(&T) -> bool { RSplit { inner: self.split(pred) } @@ -1127,7 +1127,7 @@ impl [T] { /// #[stable(feature = "slice_rsplit", since = "1.27.0")] #[inline] - pub fn rsplit_mut(&mut self, pred: F) -> RSplitMut + pub fn rsplit_mut(&mut self, pred: F) -> RSplitMut<'_, T, F> where F: FnMut(&T) -> bool { RSplitMut { inner: self.split_mut(pred) } @@ -1154,7 +1154,7 @@ impl [T] { /// ``` #[stable(feature = "rust1", since = "1.0.0")] #[inline] - pub fn splitn(&self, n: usize, pred: F) -> SplitN + pub fn splitn(&self, n: usize, pred: F) -> SplitN<'_, T, F> where F: FnMut(&T) -> bool { SplitN { @@ -1184,7 +1184,7 @@ impl [T] { /// ``` #[stable(feature = "rust1", since = "1.0.0")] #[inline] - pub fn splitn_mut(&mut self, n: usize, pred: F) -> SplitNMut + pub fn splitn_mut(&mut self, n: usize, pred: F) -> SplitNMut<'_, T, F> where F: FnMut(&T) -> bool { SplitNMut { @@ -1217,7 +1217,7 @@ impl [T] { /// ``` #[stable(feature = "rust1", since = "1.0.0")] #[inline] - pub fn rsplitn(&self, n: usize, pred: F) -> RSplitN + pub fn rsplitn(&self, n: usize, pred: F) -> RSplitN<'_, T, F> where F: FnMut(&T) -> bool { RSplitN { @@ -1248,7 +1248,7 @@ impl [T] { /// ``` #[stable(feature = "rust1", since = "1.0.0")] #[inline] - pub fn rsplitn_mut(&mut self, n: usize, pred: F) -> RSplitNMut + pub fn rsplitn_mut(&mut self, n: usize, pred: F) -> RSplitNMut<'_, T, F> where F: FnMut(&T) -> bool { RSplitNMut { @@ -3284,7 +3284,7 @@ pub struct Iter<'a, T: 'a> { #[stable(feature = "core_impl_debug", since = "1.9.0")] impl fmt::Debug for Iter<'_, T> { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.debug_tuple("Iter") .field(&self.as_slice()) .finish() @@ -3386,7 +3386,7 @@ pub struct IterMut<'a, T: 'a> { #[stable(feature = "core_impl_debug", since = "1.9.0")] impl fmt::Debug for IterMut<'_, T> { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.debug_tuple("IterMut") .field(&self.make_slice()) .finish() @@ -3493,7 +3493,7 @@ pub struct Split<'a, T:'a, P> where P: FnMut(&T) -> bool { #[stable(feature = "core_impl_debug", since = "1.9.0")] impl fmt::Debug for Split<'_, T, P> where P: FnMut(&T) -> bool { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.debug_struct("Split") .field("v", &self.v) .field("finished", &self.finished) @@ -3584,7 +3584,7 @@ pub struct SplitMut<'a, T:'a, P> where P: FnMut(&T) -> bool { #[stable(feature = "core_impl_debug", since = "1.9.0")] impl fmt::Debug for SplitMut<'_, T, P> where P: FnMut(&T) -> bool { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.debug_struct("SplitMut") .field("v", &self.v) .field("finished", &self.finished) @@ -3681,7 +3681,7 @@ pub struct RSplit<'a, T:'a, P> where P: FnMut(&T) -> bool { #[stable(feature = "slice_rsplit", since = "1.27.0")] impl fmt::Debug for RSplit<'_, T, P> where P: FnMut(&T) -> bool { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.debug_struct("RSplit") .field("v", &self.inner.v) .field("finished", &self.inner.finished) @@ -3737,7 +3737,7 @@ pub struct RSplitMut<'a, T:'a, P> where P: FnMut(&T) -> bool { #[stable(feature = "slice_rsplit", since = "1.27.0")] impl fmt::Debug for RSplitMut<'_, T, P> where P: FnMut(&T) -> bool { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.debug_struct("RSplitMut") .field("v", &self.inner.v) .field("finished", &self.inner.finished) @@ -3823,7 +3823,7 @@ pub struct SplitN<'a, T: 'a, P> where P: FnMut(&T) -> bool { #[stable(feature = "core_impl_debug", since = "1.9.0")] impl fmt::Debug for SplitN<'_, T, P> where P: FnMut(&T) -> bool { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.debug_struct("SplitN") .field("inner", &self.inner) .finish() @@ -3845,7 +3845,7 @@ pub struct RSplitN<'a, T: 'a, P> where P: FnMut(&T) -> bool { #[stable(feature = "core_impl_debug", since = "1.9.0")] impl fmt::Debug for RSplitN<'_, T, P> where P: FnMut(&T) -> bool { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.debug_struct("RSplitN") .field("inner", &self.inner) .finish() @@ -3866,7 +3866,7 @@ pub struct SplitNMut<'a, T: 'a, P> where P: FnMut(&T) -> bool { #[stable(feature = "core_impl_debug", since = "1.9.0")] impl fmt::Debug for SplitNMut<'_, T, P> where P: FnMut(&T) -> bool { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.debug_struct("SplitNMut") .field("inner", &self.inner) .finish() @@ -3888,7 +3888,7 @@ pub struct RSplitNMut<'a, T: 'a, P> where P: FnMut(&T) -> bool { #[stable(feature = "core_impl_debug", since = "1.9.0")] impl fmt::Debug for RSplitNMut<'_, T, P> where P: FnMut(&T) -> bool { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.debug_struct("RSplitNMut") .field("inner", &self.inner) .finish() diff --git a/src/libcore/str/lossy.rs b/src/libcore/str/lossy.rs index 16dd4fe6135be..b291579553a64 100644 --- a/src/libcore/str/lossy.rs +++ b/src/libcore/str/lossy.rs @@ -18,7 +18,7 @@ impl Utf8Lossy { unsafe { mem::transmute(bytes) } } - pub fn chunks(&self) -> Utf8LossyChunksIter { + pub fn chunks(&self) -> Utf8LossyChunksIter<'_> { Utf8LossyChunksIter { source: &self.bytes } } } @@ -138,7 +138,7 @@ impl<'a> Iterator for Utf8LossyChunksIter<'a> { impl fmt::Display for Utf8Lossy { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { // If we're the empty string then our iterator won't actually yield // anything, so perform the formatting manually if self.bytes.len() == 0 { @@ -164,7 +164,7 @@ impl fmt::Display for Utf8Lossy { } impl fmt::Debug for Utf8Lossy { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.write_char('"')?; for Utf8LossyChunk { valid, broken } in self.chunks() { diff --git a/src/libcore/str/mod.rs b/src/libcore/str/mod.rs index f4bb887dd2943..e83581363c866 100644 --- a/src/libcore/str/mod.rs +++ b/src/libcore/str/mod.rs @@ -146,7 +146,7 @@ pub struct ParseBoolError { _priv: () } #[stable(feature = "rust1", since = "1.0.0")] impl fmt::Display for ParseBoolError { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { "provided string was not `true` or `false`".fmt(f) } } @@ -439,7 +439,7 @@ pub unsafe fn from_utf8_unchecked_mut(v: &mut [u8]) -> &mut str { #[stable(feature = "rust1", since = "1.0.0")] impl fmt::Display for Utf8Error { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { if let Some(error_len) = self.error_len { write!(f, "invalid utf-8 sequence of {} bytes from index {}", error_len, self.valid_up_to) @@ -914,7 +914,7 @@ macro_rules! generate_pattern_iterators { impl<'a, P: Pattern<'a>> fmt::Debug for $forward_iterator<'a, P> where P::Searcher: fmt::Debug { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.debug_tuple(stringify!($forward_iterator)) .field(&self.0) .finish() @@ -948,7 +948,7 @@ macro_rules! generate_pattern_iterators { impl<'a, P: Pattern<'a>> fmt::Debug for $reverse_iterator<'a, P> where P::Searcher: fmt::Debug { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.debug_tuple(stringify!($reverse_iterator)) .field(&self.0) .finish() @@ -1033,7 +1033,7 @@ struct SplitInternal<'a, P: Pattern<'a>> { } impl<'a, P: Pattern<'a>> fmt::Debug for SplitInternal<'a, P> where P::Searcher: fmt::Debug { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.debug_struct("SplitInternal") .field("start", &self.start) .field("end", &self.end) @@ -1150,7 +1150,7 @@ struct SplitNInternal<'a, P: Pattern<'a>> { } impl<'a, P: Pattern<'a>> fmt::Debug for SplitNInternal<'a, P> where P::Searcher: fmt::Debug { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.debug_struct("SplitNInternal") .field("iter", &self.iter) .field("count", &self.count) @@ -1206,7 +1206,7 @@ derive_pattern_clone!{ struct MatchIndicesInternal<'a, P: Pattern<'a>>(P::Searcher); impl<'a, P: Pattern<'a>> fmt::Debug for MatchIndicesInternal<'a, P> where P::Searcher: fmt::Debug { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.debug_tuple("MatchIndicesInternal") .field(&self.0) .finish() @@ -1257,7 +1257,7 @@ derive_pattern_clone!{ struct MatchesInternal<'a, P: Pattern<'a>>(P::Searcher); impl<'a, P: Pattern<'a>> fmt::Debug for MatchesInternal<'a, P> where P::Searcher: fmt::Debug { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.debug_tuple("MatchesInternal") .field(&self.0) .finish() @@ -2559,7 +2559,7 @@ impl str { /// ``` #[stable(feature = "rust1", since = "1.0.0")] #[inline] - pub fn chars(&self) -> Chars { + pub fn chars(&self) -> Chars<'_> { Chars{iter: self.as_bytes().iter()} } @@ -2614,7 +2614,7 @@ impl str { /// ``` #[stable(feature = "rust1", since = "1.0.0")] #[inline] - pub fn char_indices(&self) -> CharIndices { + pub fn char_indices(&self) -> CharIndices<'_> { CharIndices { front_offset: 0, iter: self.chars() } } @@ -2639,7 +2639,7 @@ impl str { /// ``` #[stable(feature = "rust1", since = "1.0.0")] #[inline] - pub fn bytes(&self) -> Bytes { + pub fn bytes(&self) -> Bytes<'_> { Bytes(self.as_bytes().iter().cloned()) } @@ -2682,7 +2682,7 @@ impl str { /// ``` #[stable(feature = "split_whitespace", since = "1.1.0")] #[inline] - pub fn split_whitespace(&self) -> SplitWhitespace { + pub fn split_whitespace(&self) -> SplitWhitespace<'_> { SplitWhitespace { inner: self.split(IsWhitespace).filter(IsNotEmpty) } } @@ -2723,7 +2723,7 @@ impl str { /// ``` #[stable(feature = "split_ascii_whitespace", since = "1.34.0")] #[inline] - pub fn split_ascii_whitespace(&self) -> SplitAsciiWhitespace { + pub fn split_ascii_whitespace(&self) -> SplitAsciiWhitespace<'_> { let inner = self .as_bytes() .split(IsAsciiWhitespace) @@ -2770,7 +2770,7 @@ impl str { /// ``` #[stable(feature = "rust1", since = "1.0.0")] #[inline] - pub fn lines(&self) -> Lines { + pub fn lines(&self) -> Lines<'_> { Lines(self.split_terminator('\n').map(LinesAnyMap)) } @@ -2779,7 +2779,7 @@ impl str { #[rustc_deprecated(since = "1.4.0", reason = "use lines() instead now")] #[inline] #[allow(deprecated)] - pub fn lines_any(&self) -> LinesAny { + pub fn lines_any(&self) -> LinesAny<'_> { LinesAny(self.lines()) } @@ -2798,7 +2798,7 @@ impl str { /// assert!(utf16_len <= utf8_len); /// ``` #[stable(feature = "encode_utf16", since = "1.8.0")] - pub fn encode_utf16(&self) -> EncodeUtf16 { + pub fn encode_utf16(&self) -> EncodeUtf16<'_> { EncodeUtf16 { chars: self.chars(), extra: 0 } } @@ -4018,7 +4018,7 @@ impl str { /// assert_eq!("❤\n!".escape_debug().to_string(), "❤\\n!"); /// ``` #[stable(feature = "str_escape", since = "1.34.0")] - pub fn escape_debug(&self) -> EscapeDebug { + pub fn escape_debug(&self) -> EscapeDebug<'_> { let mut chars = self.chars(); EscapeDebug { inner: chars.next() @@ -4063,7 +4063,7 @@ impl str { /// assert_eq!("❤\n!".escape_default().to_string(), "\\u{2764}\\n!"); /// ``` #[stable(feature = "str_escape", since = "1.34.0")] - pub fn escape_default(&self) -> EscapeDefault { + pub fn escape_default(&self) -> EscapeDefault<'_> { EscapeDefault { inner: self.chars().flat_map(CharEscapeDefault) } } @@ -4101,7 +4101,7 @@ impl str { /// assert_eq!("❤\n!".escape_unicode().to_string(), "\\u{2764}\\u{a}\\u{21}"); /// ``` #[stable(feature = "str_escape", since = "1.34.0")] - pub fn escape_unicode(&self) -> EscapeUnicode { + pub fn escape_unicode(&self) -> EscapeUnicode<'_> { EscapeUnicode { inner: self.chars().flat_map(CharEscapeUnicode) } } } @@ -4267,7 +4267,7 @@ pub struct EncodeUtf16<'a> { #[stable(feature = "collection_debug", since = "1.17.0")] impl fmt::Debug for EncodeUtf16<'_> { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.pad("EncodeUtf16 { .. }") } } @@ -4341,7 +4341,7 @@ macro_rules! escape_types_impls { ($( $Name: ident ),+) => {$( #[stable(feature = "str_escape", since = "1.34.0")] impl<'a> fmt::Display for $Name<'a> { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { self.clone().try_for_each(|c| f.write_char(c)) } } diff --git a/src/libcore/str/pattern.rs b/src/libcore/str/pattern.rs index 5dd4aec5e5a57..ad9d956fda1c8 100644 --- a/src/libcore/str/pattern.rs +++ b/src/libcore/str/pattern.rs @@ -658,7 +658,7 @@ pub struct CharPredicateSearcher<'a, F>( as Pattern<'a>>:: impl fmt::Debug for CharPredicateSearcher<'_, F> where F: FnMut(char) -> bool { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.debug_struct("CharPredicateSearcher") .field("haystack", &self.0.haystack) .field("char_indices", &self.0.char_indices) diff --git a/src/libcore/sync/atomic.rs b/src/libcore/sync/atomic.rs index 7ae91b3049814..12414980d76b1 100644 --- a/src/libcore/sync/atomic.rs +++ b/src/libcore/sync/atomic.rs @@ -1193,7 +1193,7 @@ macro_rules! atomic_int { #[$stable_debug] impl fmt::Debug for $atomic_type { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fmt::Debug::fmt(&self.load(Ordering::SeqCst), f) } } @@ -2506,7 +2506,7 @@ pub fn compiler_fence(order: Ordering) { #[cfg(target_has_atomic = "8")] #[stable(feature = "atomic_debug", since = "1.3.0")] impl fmt::Debug for AtomicBool { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fmt::Debug::fmt(&self.load(Ordering::SeqCst), f) } } @@ -2514,7 +2514,7 @@ impl fmt::Debug for AtomicBool { #[cfg(target_has_atomic = "ptr")] #[stable(feature = "atomic_debug", since = "1.3.0")] impl fmt::Debug for AtomicPtr { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fmt::Debug::fmt(&self.load(Ordering::SeqCst), f) } } @@ -2522,7 +2522,7 @@ impl fmt::Debug for AtomicPtr { #[cfg(target_has_atomic = "ptr")] #[stable(feature = "atomic_pointer", since = "1.24.0")] impl fmt::Pointer for AtomicPtr { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fmt::Pointer::fmt(&self.load(Ordering::SeqCst), f) } } diff --git a/src/libcore/task/wake.rs b/src/libcore/task/wake.rs index 1d3140070f351..94e31054a5812 100644 --- a/src/libcore/task/wake.rs +++ b/src/libcore/task/wake.rs @@ -180,7 +180,7 @@ impl<'a> Context<'a> { } impl fmt::Debug for Context<'_> { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.debug_struct("Context") .field("waker", &self.waker) .finish() @@ -283,7 +283,7 @@ impl Drop for Waker { } impl fmt::Debug for Waker { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { let vtable_ptr = self.waker.vtable as *const RawWakerVTable; f.debug_struct("Waker") .field("data", &self.waker.data) diff --git a/src/libcore/time.rs b/src/libcore/time.rs index 9bb187e7de9f6..0f5f91f41a8cd 100644 --- a/src/libcore/time.rs +++ b/src/libcore/time.rs @@ -847,7 +847,7 @@ impl<'a> Sum<&'a Duration> for Duration { #[stable(feature = "duration_debug_impl", since = "1.27.0")] impl fmt::Debug for Duration { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { /// Formats a floating point number in decimal notation. /// /// The number is given as the `integer_part` and a fractional part. @@ -859,7 +859,7 @@ impl fmt::Debug for Duration { /// of 10, everything else doesn't make sense. `fractional_part` has /// to be less than `10 * divisor`! fn fmt_decimal( - f: &mut fmt::Formatter, + f: &mut fmt::Formatter<'_>, mut integer_part: u64, mut fractional_part: u32, mut divisor: u32,