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 Jun 20, 2022
1 parent bb8bdf0 commit fe4f5d8
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions src/internal_macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,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 @@ -200,8 +200,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 @@ -225,8 +225,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 @@ -256,8 +256,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 @@ -433,8 +433,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 @@ -463,8 +463,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 @@ -541,8 +541,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 fe4f5d8

Please sign in to comment.