Skip to content

Commit

Permalink
Use f instead of formatter
Browse files Browse the repository at this point in the history
The local variable `formatter` can be shortened to `f` with no loss of
clarity since it is so common.

Done in preparation for running `rustfmt` on `src`.
  • Loading branch information
tcharding committed Jul 19, 2022
1 parent 7b50a96 commit fd217e7
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions src/internal_macros.rs
Expand Up @@ -142,8 +142,8 @@ macro_rules! serde_string_impl {
impl<'de> $crate::serde::de::Visitor<'de> for Visitor {
type Value = $name;

fn expecting(&self, formatter: &mut Formatter) -> fmt::Result {
formatter.write_str($expecting)
fn expecting(&self, f: &mut Formatter) -> fmt::Result {
f.write_str($expecting)
}

fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
Expand Down Expand Up @@ -190,8 +190,8 @@ macro_rules! serde_struct_human_string_impl {
impl<'de> $crate::serde::de::Visitor<'de> for Visitor {
type Value = $name;

fn expecting(&self, formatter: &mut Formatter) -> fmt::Result {
formatter.write_str($expecting)
fn expecting(&self, f: &mut Formatter) -> fmt::Result {
f.write_str($expecting)
}

fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
Expand All @@ -215,8 +215,8 @@ macro_rules! serde_struct_human_string_impl {
impl<'de> $crate::serde::de::Visitor<'de> for EnumVisitor {
type Value = Enum;

fn expecting(&self, formatter: &mut Formatter) -> fmt::Result {
formatter.write_str("a field name")
fn expecting(&self, f: &mut Formatter) -> fmt::Result {
f.write_str("a field name")
}

fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
Expand Down Expand Up @@ -246,8 +246,8 @@ macro_rules! serde_struct_human_string_impl {
impl<'de> $crate::serde::de::Visitor<'de> for Visitor {
type Value = $name;

fn expecting(&self, formatter: &mut Formatter) -> fmt::Result {
formatter.write_str("a struct")
fn expecting(&self, f: &mut Formatter) -> fmt::Result {
f.write_str("a struct")
}

fn visit_seq<V>(self, mut seq: V) -> Result<Self::Value, V::Error>
Expand Down Expand Up @@ -423,8 +423,8 @@ macro_rules! impl_bytes_newtype {
impl<'de> $crate::serde::de::Visitor<'de> for HexVisitor {
type Value = $t;

fn expecting(&self, formatter: &mut core::fmt::Formatter) -> core::fmt::Result {
formatter.write_str("an ASCII hex string")
fn expecting(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.write_str("an ASCII hex string")
}

fn visit_bytes<E>(self, v: &[u8]) -> Result<Self::Value, E>
Expand Down Expand Up @@ -453,8 +453,8 @@ macro_rules! impl_bytes_newtype {
impl<'de> $crate::serde::de::Visitor<'de> for BytesVisitor {
type Value = $t;

fn expecting(&self, formatter: &mut core::fmt::Formatter) -> core::fmt::Result {
formatter.write_str("a bytestring")
fn expecting(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.write_str("a bytestring")
}

fn visit_bytes<E>(self, v: &[u8]) -> Result<Self::Value, E>
Expand Down Expand Up @@ -531,8 +531,8 @@ macro_rules! user_enum {
impl<'de> $crate::serde::de::Visitor<'de> for Visitor {
type Value = $name;

fn expecting(&self, formatter: &mut Formatter) -> fmt::Result {
formatter.write_str("an enum value")
fn expecting(&self, f: &mut Formatter) -> fmt::Result {
f.write_str("an enum value")
}

fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
Expand Down

0 comments on commit fd217e7

Please sign in to comment.