Format with rustfmt 0.6.0

This commit is contained in:
David Tolnay
2018-04-30 01:41:22 -07:00
parent 89278996c5
commit d82d1707d6
10 changed files with 152 additions and 174 deletions
+13 -7
View File
@@ -1,8 +1,9 @@
use serde::de::{Deserializer, Visitor, SeqAccess, Error};
use serde::de::{Deserializer, Error, SeqAccess, Visitor};
use std::fmt;
pub fn deserialize<'de, D>(deserializer: D) -> Result<Vec<u8>, D::Error>
where D: Deserializer<'de>
where
D: Deserializer<'de>,
{
deserializer.deserialize_byte_buf(ByteBufVisitor)
}
@@ -17,7 +18,8 @@ impl<'de> Visitor<'de> for ByteBufVisitor {
}
fn visit_seq<V>(self, mut visitor: V) -> Result<Self::Value, V::Error>
where V: SeqAccess<'de>
where
V: SeqAccess<'de>,
{
let mut values = Vec::new();
while let Some(value) = try!(visitor.next_element()) {
@@ -27,25 +29,29 @@ impl<'de> Visitor<'de> for ByteBufVisitor {
}
fn visit_bytes<E>(self, v: &[u8]) -> Result<Self::Value, E>
where E: Error
where
E: Error,
{
Ok(v.to_vec())
}
fn visit_byte_buf<E>(self, v: Vec<u8>) -> Result<Self::Value, E>
where E: Error
where
E: Error,
{
Ok(v)
}
fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
where E: Error
where
E: Error,
{
Ok(v.as_bytes().to_vec())
}
fn visit_string<E>(self, v: String) -> Result<Self::Value, E>
where E: Error
where
E: Error,
{
Ok(v.into_bytes())
}