Skip to content

Commit

Permalink
Serializer::collect_str: Format with cargo fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
elrafoon committed Jan 22, 2024
1 parent 6767ae1 commit e13c3f8
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/ser/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -447,15 +447,14 @@ impl<'a, 'b: 'a> ser::Serializer for &'a mut Serializer<'b> {
self.push(b'"')?;

let mut col = StringCollector::new(self);
fmt::write(&mut col, format_args!("{}", value))
.or(Err(Error::BufferFull))?;
fmt::write(&mut col, format_args!("{}", value)).or(Err(Error::BufferFull))?;

self.push(b'"')
}
}

struct StringCollector<'a, 'b> {
ser: &'a mut Serializer<'b>
ser: &'a mut Serializer<'b>,
}

impl<'a, 'b> StringCollector<'a, 'b> {
Expand All @@ -478,7 +477,6 @@ impl<'a, 'b> fmt::Write for StringCollector<'a, 'b> {
}
}


/// Serializes the given data structure as a string of JSON text
#[cfg(feature = "heapless")]
pub fn to_string<T, const N: usize>(value: &T) -> Result<String<N>>
Expand Down

0 comments on commit e13c3f8

Please sign in to comment.