aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEdward Barnard2017-02-22 10:28:39 +0000
committerEdward Barnard2017-02-22 10:28:39 +0000
commitba0703033773605c2bcb06ee31014550d064c8d7 (patch)
treecdd930e4508a3224e1fc2666f2f03d26585b0a1b /src
parent147672ce1f2d069b4c736fa4855769ba8bc040e7 (diff)
downloadrust-plist-ba0703033773605c2bcb06ee31014550d064c8d7.tar.bz2
Rustfmt.
Diffstat (limited to 'src')
-rw-r--r--src/plist.rs104
-rw-r--r--src/xml/reader.rs16
-rw-r--r--src/xml/writer.rs6
3 files changed, 88 insertions, 38 deletions
diff --git a/src/plist.rs b/src/plist.rs
index 0309528..313cc12 100644
--- a/src/plist.rs
+++ b/src/plist.rs
@@ -199,107 +199,159 @@ impl Plist {
}
impl From<Vec<Plist>> for Plist {
- fn from(from: Vec<Plist>) -> Plist { Plist::Array(from) }
+ fn from(from: Vec<Plist>) -> Plist {
+ Plist::Array(from)
+ }
}
impl From<BTreeMap<String, Plist>> for Plist {
- fn from(from: BTreeMap<String, Plist>) -> Plist { Plist::Dictionary(from) }
+ fn from(from: BTreeMap<String, Plist>) -> Plist {
+ Plist::Dictionary(from)
+ }
}
impl From<bool> for Plist {
- fn from(from: bool) -> Plist { Plist::Boolean(from) }
+ fn from(from: bool) -> Plist {
+ Plist::Boolean(from)
+ }
}
impl<'a> From<&'a bool> for Plist {
- fn from(from: &'a bool) -> Plist { Plist::Boolean(*from) }
+ fn from(from: &'a bool) -> Plist {
+ Plist::Boolean(*from)
+ }
}
impl From<DateTime<UTC>> for Plist {
- fn from(from: DateTime<UTC>) -> Plist { Plist::Date(from) }
+ fn from(from: DateTime<UTC>) -> Plist {
+ Plist::Date(from)
+ }
}
impl<'a> From<&'a DateTime<UTC>> for Plist {
- fn from(from: &'a DateTime<UTC>) -> Plist { Plist::Date(from.clone()) }
+ fn from(from: &'a DateTime<UTC>) -> Plist {
+ Plist::Date(from.clone())
+ }
}
impl From<f64> for Plist {
- fn from(from: f64) -> Plist { Plist::Real(from) }
+ fn from(from: f64) -> Plist {
+ Plist::Real(from)
+ }
}
impl From<f32> for Plist {
- fn from(from: f32) -> Plist { Plist::Real(from as f64) }
+ fn from(from: f32) -> Plist {
+ Plist::Real(from as f64)
+ }
}
impl From<i64> for Plist {
- fn from(from: i64) -> Plist { Plist::Integer(from) }
+ fn from(from: i64) -> Plist {
+ Plist::Integer(from)
+ }
}
impl From<i32> for Plist {
- fn from(from: i32) -> Plist { Plist::Integer(from as i64) }
+ fn from(from: i32) -> Plist {
+ Plist::Integer(from as i64)
+ }
}
impl From<i16> for Plist {
- fn from(from: i16) -> Plist { Plist::Integer(from as i64) }
+ fn from(from: i16) -> Plist {
+ Plist::Integer(from as i64)
+ }
}
impl From<i8> for Plist {
- fn from(from: i8) -> Plist { Plist::Integer(from as i64) }
+ fn from(from: i8) -> Plist {
+ Plist::Integer(from as i64)
+ }
}
impl From<u32> for Plist {
- fn from(from: u32) -> Plist { Plist::Integer(from as i64) }
+ fn from(from: u32) -> Plist {
+ Plist::Integer(from as i64)
+ }
}
impl From<u16> for Plist {
- fn from(from: u16) -> Plist { Plist::Integer(from as i64) }
+ fn from(from: u16) -> Plist {
+ Plist::Integer(from as i64)
+ }
}
impl From<u8> for Plist {
- fn from(from: u8) -> Plist { Plist::Integer(from as i64) }
+ fn from(from: u8) -> Plist {
+ Plist::Integer(from as i64)
+ }
}
impl<'a> From<&'a f64> for Plist {
- fn from(from: &'a f64) -> Plist { Plist::Real(*from) }
+ fn from(from: &'a f64) -> Plist {
+ Plist::Real(*from)
+ }
}
impl<'a> From<&'a f32> for Plist {
- fn from(from: &'a f32) -> Plist { Plist::Real(*from as f64) }
+ fn from(from: &'a f32) -> Plist {
+ Plist::Real(*from as f64)
+ }
}
impl<'a> From<&'a i64> for Plist {
- fn from(from: &'a i64) -> Plist { Plist::Integer(*from) }
+ fn from(from: &'a i64) -> Plist {
+ Plist::Integer(*from)
+ }
}
impl<'a> From<&'a i32> for Plist {
- fn from(from: &'a i32) -> Plist { Plist::Integer(*from as i64) }
+ fn from(from: &'a i32) -> Plist {
+ Plist::Integer(*from as i64)
+ }
}
impl<'a> From<&'a i16> for Plist {
- fn from(from: &'a i16) -> Plist { Plist::Integer(*from as i64) }
+ fn from(from: &'a i16) -> Plist {
+ Plist::Integer(*from as i64)
+ }
}
impl<'a> From<&'a i8> for Plist {
- fn from(from: &'a i8) -> Plist { Plist::Integer(*from as i64) }
+ fn from(from: &'a i8) -> Plist {
+ Plist::Integer(*from as i64)
+ }
}
impl<'a> From<&'a u32> for Plist {
- fn from(from: &'a u32) -> Plist { Plist::Integer(*from as i64) }
+ fn from(from: &'a u32) -> Plist {
+ Plist::Integer(*from as i64)
+ }
}
impl<'a> From<&'a u16> for Plist {
- fn from(from: &'a u16) -> Plist { Plist::Integer(*from as i64) }
+ fn from(from: &'a u16) -> Plist {
+ Plist::Integer(*from as i64)
+ }
}
impl<'a> From<&'a u8> for Plist {
- fn from(from: &'a u8) -> Plist { Plist::Integer(*from as i64) }
+ fn from(from: &'a u8) -> Plist {
+ Plist::Integer(*from as i64)
+ }
}
impl From<String> for Plist {
- fn from(from: String) -> Plist { Plist::String(from) }
+ fn from(from: String) -> Plist {
+ Plist::String(from)
+ }
}
impl<'a> From<&'a str> for Plist {
- fn from(from: &'a str) -> Plist { Plist::String(from.into()) }
+ fn from(from: &'a str) -> Plist {
+ Plist::String(from.into())
+ }
}
#[cfg(test)]
diff --git a/src/xml/reader.rs b/src/xml/reader.rs
index d7ec99e..6af89b0 100644
--- a/src/xml/reader.rs
+++ b/src/xml/reader.rs
@@ -88,19 +88,15 @@ impl<R: Read> EventReader<R> {
}))
}
"integer" => {
- return Some(self.read_content(|s| {
- match FromStr::from_str(&s) {
- Ok(i) => Ok(PlistEvent::IntegerValue(i)),
- Err(_) => Err(Error::InvalidData),
- }
+ return Some(self.read_content(|s| match FromStr::from_str(&s) {
+ Ok(i) => Ok(PlistEvent::IntegerValue(i)),
+ Err(_) => Err(Error::InvalidData),
}))
}
"real" => {
- return Some(self.read_content(|s| {
- match FromStr::from_str(&s) {
- Ok(f) => Ok(PlistEvent::RealValue(f)),
- Err(_) => Err(Error::InvalidData),
- }
+ return Some(self.read_content(|s| match FromStr::from_str(&s) {
+ Ok(f) => Ok(PlistEvent::RealValue(f)),
+ Err(_) => Err(Error::InvalidData),
}))
}
"string" => {
diff --git a/src/xml/writer.rs b/src/xml/writer.rs
index 400663d..9018e2d 100644
--- a/src/xml/writer.rs
+++ b/src/xml/writer.rs
@@ -85,7 +85,8 @@ impl<W: Write> EventWriter<W> {
// If there are no more open tags then write the </plist> element
if self.stack.len() == 1 {
try!(self.end_element("plist"));
- if let Some(Element::Root) = self.stack.pop() {} else {
+ if let Some(Element::Root) = self.stack.pop() {
+ } else {
return Err(Error::InvalidData);
}
}
@@ -140,7 +141,8 @@ impl<W: Write> PlistEventWriter for EventWriter<W> {
}
PlistEvent::EndArray => {
try!(self.end_element("array"));
- if let Some(Element::Array) = self.stack.pop() {} else {
+ if let Some(Element::Array) = self.stack.pop() {
+ } else {
return Err(Error::InvalidData);
}
}