Use deref coercions when possible

This commit is contained in:
Thomas Bahn
2015-02-06 14:08:02 +01:00
parent 361acd37d0
commit 3022d7301a
14 changed files with 54 additions and 54 deletions
+2 -2
View File
@@ -53,14 +53,14 @@ fn escape_char<W: Writer>(wr: &mut W, v: char) -> IoResult<()> {
fn fmt_f32_or_null<W: Writer>(wr: &mut W, v: f32) -> IoResult<()> {
match v.classify() {
FpCategory::Nan | FpCategory::Infinite => wr.write_str("null"),
_ => wr.write_str(f32::to_str_digits(v, 6).as_slice()),
_ => wr.write_str(&f32::to_str_digits(v, 6)),
}
}
fn fmt_f64_or_null<W: Writer>(wr: &mut W, v: f64) -> IoResult<()> {
match v.classify() {
FpCategory::Nan | FpCategory::Infinite => wr.write_str("null"),
_ => wr.write_str(f64::to_str_digits(v, 6).as_slice()),
_ => wr.write_str(&f64::to_str_digits(v, 6)),
}
}