diff options
Diffstat (limited to 'src/decoder')
-rw-r--r-- | src/decoder/mod.rs | 6 | ||||
-rw-r--r-- | src/decoder/rustc_serialize.rs | 4 |
2 files changed, 5 insertions, 5 deletions
diff --git a/src/decoder/mod.rs b/src/decoder/mod.rs index a596280..b223e03 100644 --- a/src/decoder/mod.rs +++ b/src/decoder/mod.rs @@ -126,11 +126,11 @@ impl Decoder { fn sub_decoder(&self, toml: Option<Value>, field: &str) -> Decoder { Decoder { toml: toml, - cur_field: if field.len() == 0 { + cur_field: if field.is_empty() { self.cur_field.clone() } else { match self.cur_field { - None => Some(format!("{}", field)), + None => Some(field.to_string()), Some(ref s) => Some(format!("{}.{}", s, field)) } }, @@ -172,7 +172,7 @@ impl fmt::Display for DecodeError { ExpectedType(expected, found) => { fn humanize(s: &str) -> String { if s == "section" { - format!("a section") + "a section".to_string() } else { format!("a value of type `{}`", s) } diff --git a/src/decoder/rustc_serialize.rs b/src/decoder/rustc_serialize.rs index 2f4fb09..f850663 100644 --- a/src/decoder/rustc_serialize.rs +++ b/src/decoder/rustc_serialize.rs @@ -171,7 +171,7 @@ impl rustc_serialize::Decoder for Decoder { -> Result<T, DecodeError> where F: FnOnce(&mut Decoder) -> Result<T, DecodeError> { - let field = format!("{}", f_name); + let field = f_name.to_string(); let toml = match self.toml { Some(Value::Table(ref mut table)) => { table.remove(&field) @@ -324,7 +324,7 @@ impl rustc_serialize::Decoder for Decoder { fn error(&mut self, err: &str) -> DecodeError { DecodeError { field: self.cur_field.clone(), - kind: ApplicationError(format!("{}", err)) + kind: ApplicationError(err.to_string()) } } } |