aboutsummaryrefslogtreecommitdiff
path: root/src/decoder
diff options
context:
space:
mode:
authorleonardo.yvens <leoyvens@gmail.com>2016-06-03 23:14:42 -0300
committerleonardo.yvens <leoyvens@gmail.com>2016-06-03 23:19:15 -0300
commite8097b14f1ea246bf97af380670c502ba1517f30 (patch)
tree40af4185d533d301627959030c2c380771f8f460 /src/decoder
parent44fc9d9f37cd1b2e3d9170d04fd0a8a04d7884ff (diff)
downloadmilf-rs-e8097b14f1ea246bf97af380670c502ba1517f30.tar.gz
milf-rs-e8097b14f1ea246bf97af380670c502ba1517f30.zip
Clippy run
Diffstat (limited to 'src/decoder')
-rw-r--r--src/decoder/mod.rs6
-rw-r--r--src/decoder/rustc_serialize.rs4
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())
}
}
}