Simplify the return types

This commit is contained in:
Erick Tryzelaar
2015-04-26 11:01:55 -07:00
parent 8d4de2b3db
commit 12cf2f0b0b
+3 -3
View File
@@ -19,7 +19,7 @@ impl<W> Serializer<W>
{ {
/// Creates a new JSON serializer. /// Creates a new JSON serializer.
#[inline] #[inline]
pub fn new(writer: W) -> Serializer<W> { pub fn new(writer: W) -> Self {
Serializer::with_formatter(writer, CompactFormatter) Serializer::with_formatter(writer, CompactFormatter)
} }
} }
@@ -29,7 +29,7 @@ impl<W> Serializer<W, PrettyFormatter<'static>>
{ {
/// Creates a new JSON pretty print serializer. /// Creates a new JSON pretty print serializer.
#[inline] #[inline]
pub fn pretty(writer: W) -> Serializer<W, PrettyFormatter<'static>> { pub fn pretty(writer: W) -> Self {
Serializer::with_formatter(writer, PrettyFormatter::new()) Serializer::with_formatter(writer, PrettyFormatter::new())
} }
} }
@@ -41,7 +41,7 @@ impl<W, F> Serializer<W, F>
/// Creates a new JSON visitor whose output will be written to the writer /// Creates a new JSON visitor whose output will be written to the writer
/// specified. /// specified.
#[inline] #[inline]
pub fn with_formatter(writer: W, formatter: F) -> Serializer<W, F> { pub fn with_formatter(writer: W, formatter: F) -> Self {
Serializer { Serializer {
writer: writer, writer: writer,
formatter: formatter, formatter: formatter,