From 3ee59696e5373afbc7ad2b4e4bbc6f00c3dd0ff0 Mon Sep 17 00:00:00 2001 From: Felix Rabe Date: Tue, 9 Jul 2019 23:49:07 +0200 Subject: [PATCH] Always use `f` as the argument name for `&mut std::fmt::Formatter` (#1023) --- src/error.rs | 18 +++++++++--------- src/event_loop.rs | 12 ++++++------ src/icon.rs | 4 ++-- src/platform_impl/ios/event_loop.rs | 5 ++--- src/platform_impl/linux/mod.rs | 6 +++--- 5 files changed, 22 insertions(+), 23 deletions(-) diff --git a/src/error.rs b/src/error.rs index 59082eb9..c039f3b8 100644 --- a/src/error.rs +++ b/src/error.rs @@ -48,8 +48,8 @@ macro_rules! os_error { } impl fmt::Display for OsError { - fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> Result<(), fmt::Error> { - formatter.pad(&format!( + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> Result<(), fmt::Error> { + f.pad(&format!( "os error at {}:{}: {}", self.file, self.line, self.error )) @@ -57,23 +57,23 @@ impl fmt::Display for OsError { } impl fmt::Display for ExternalError { - fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> Result<(), fmt::Error> { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> Result<(), fmt::Error> { match self { - ExternalError::NotSupported(e) => e.fmt(formatter), - ExternalError::Os(e) => e.fmt(formatter), + ExternalError::NotSupported(e) => e.fmt(f), + ExternalError::Os(e) => e.fmt(f), } } } impl fmt::Debug for NotSupportedError { - fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> Result<(), fmt::Error> { - formatter.debug_struct("NotSupportedError").finish() + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> Result<(), fmt::Error> { + f.debug_struct("NotSupportedError").finish() } } impl fmt::Display for NotSupportedError { - fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> Result<(), fmt::Error> { - formatter.pad("the requested operation is not supported by Winit") + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> Result<(), fmt::Error> { + f.pad("the requested operation is not supported by Winit") } } diff --git a/src/event_loop.rs b/src/event_loop.rs index dc0e2e3b..b8fd4ca4 100644 --- a/src/event_loop.rs +++ b/src/event_loop.rs @@ -46,14 +46,14 @@ pub struct EventLoopWindowTarget { } impl fmt::Debug for EventLoop { - fn fmt(&self, fmtr: &mut fmt::Formatter<'_>) -> fmt::Result { - fmtr.pad("EventLoop { .. }") + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.pad("EventLoop { .. }") } } impl fmt::Debug for EventLoopWindowTarget { - fn fmt(&self, fmtr: &mut fmt::Formatter<'_>) -> fmt::Result { - fmtr.pad("EventLoopWindowTarget { .. }") + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.pad("EventLoopWindowTarget { .. }") } } @@ -189,8 +189,8 @@ impl EventLoopProxy { } impl fmt::Debug for EventLoopProxy { - fn fmt(&self, fmtr: &mut fmt::Formatter<'_>) -> fmt::Result { - fmtr.pad("EventLoopProxy { .. }") + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.pad("EventLoopProxy { .. }") } } diff --git a/src/icon.rs b/src/icon.rs index 69cb5290..bbbb53f9 100644 --- a/src/icon.rs +++ b/src/icon.rs @@ -28,7 +28,7 @@ pub enum BadIcon { } impl fmt::Display for BadIcon { - fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { let msg = match self { &BadIcon::ByteCountNotDivisibleBy4 { byte_count } => format!( "The length of the `rgba` argument ({:?}) isn't divisible by 4, making it impossible to interpret as 32bpp RGBA pixels.", @@ -44,7 +44,7 @@ impl fmt::Display for BadIcon { width, height, pixel_count, width_x_height, ), }; - write!(formatter, "{}", msg) + write!(f, "{}", msg) } } diff --git a/src/platform_impl/ios/event_loop.rs b/src/platform_impl/ios/event_loop.rs index 826d9658..469d11b1 100644 --- a/src/platform_impl/ios/event_loop.rs +++ b/src/platform_impl/ios/event_loop.rs @@ -264,9 +264,8 @@ struct EventLoopHandler { } impl Debug for EventLoopHandler { - fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result { - formatter - .debug_struct("EventLoopHandler") + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("EventLoopHandler") .field("event_loop", &self.event_loop) .finish() } diff --git a/src/platform_impl/linux/mod.rs b/src/platform_impl/linux/mod.rs index 62366a13..73d9f643 100644 --- a/src/platform_impl/linux/mod.rs +++ b/src/platform_impl/linux/mod.rs @@ -55,10 +55,10 @@ pub enum OsError { } impl fmt::Display for OsError { - fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> Result<(), fmt::Error> { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> Result<(), fmt::Error> { match self { - OsError::XError(e) => formatter.pad(&e.description), - OsError::XMisc(e) => formatter.pad(e), + OsError::XError(e) => f.pad(&e.description), + OsError::XMisc(e) => f.pad(e), } } }