Skip to content

Commit 695e348

Browse files
committed
Apply rustfmt
1 parent feb3171 commit 695e348

File tree

1 file changed

+30
-8
lines changed

1 file changed

+30
-8
lines changed

src/resp.rs

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010

1111
//! An implementation of the RESP protocol
1212
13-
use std::hash::Hash;
1413
use std::collections::HashMap;
14+
use std::hash::Hash;
1515
use std::io;
1616
use std::str;
1717

@@ -201,8 +201,16 @@ impl<K: FromResp + Hash + Eq, T: FromResp> FromResp for HashMap<K, T> {
201201
break;
202202
}
203203

204-
let key = K::from_resp(items.next().ok_or(error::resp("Cannot be converted into a hashmap", "".into()))?)?;
205-
let value = T::from_resp(items.next().ok_or(error::resp("Cannot be converted into a hashmap", "".into()))?)?;
204+
let key = K::from_resp(
205+
items
206+
.next()
207+
.ok_or(error::resp("Cannot be converted into a hashmap", "".into()))?,
208+
)?;
209+
let value = T::from_resp(
210+
items
211+
.next()
212+
.ok_or(error::resp("Cannot be converted into a hashmap", "".into()))?,
213+
)?;
206214

207215
map.insert(key, value);
208216
}
@@ -711,8 +719,16 @@ mod tests {
711719
expected.insert("KEY1".to_string(), "VALUE1".to_string());
712720
expected.insert("KEY2".to_string(), "VALUE2".to_string());
713721

714-
let resp_object = RespValue::Array(vec!["KEY1".into(), "VALUE1".into(), "KEY2".into(), "VALUE2".into()]);
715-
assert_eq!(HashMap::<String, String>::from_resp(resp_object).unwrap(), expected);
722+
let resp_object = RespValue::Array(vec![
723+
"KEY1".into(),
724+
"VALUE1".into(),
725+
"KEY2".into(),
726+
"VALUE2".into(),
727+
]);
728+
assert_eq!(
729+
HashMap::<String, String>::from_resp(resp_object).unwrap(),
730+
expected
731+
);
716732
}
717733

718734
#[test]
@@ -722,12 +738,18 @@ mod tests {
722738
expected.insert("KEY2".to_string(), "VALUE2".to_string());
723739
expected.insert("KEY3".to_string(), "VALUE3".to_string());
724740

725-
let resp_object = RespValue::Array(vec!["KEY1".into(), "VALUE1".into(), "KEY2".into(), "VALUE2".into(), "KEY3".into()]);
741+
let resp_object = RespValue::Array(vec![
742+
"KEY1".into(),
743+
"VALUE1".into(),
744+
"KEY2".into(),
745+
"VALUE2".into(),
746+
"KEY3".into(),
747+
]);
726748
let res = HashMap::<String, String>::from_resp(resp_object);
727749

728750
match res {
729-
Err(Error::RESP(_, _)) => {},
730-
_ => panic!("Converted to an uneven array of elements to a hashmap")
751+
Err(Error::RESP(_, _)) => {}
752+
_ => panic!("Converted to an uneven array of elements to a hashmap"),
731753
}
732754
}
733755
}

0 commit comments

Comments
 (0)