diff options
| -rw-r--r-- | src/lib.rs | 11 | ||||
| -rw-r--r-- | tests/fuzzer.rs | 4 | ||||
| -rw-r--r-- | tests/serde_tests/mod.rs | 8 |
3 files changed, 11 insertions, 12 deletions
@@ -81,8 +81,7 @@ extern crate serde as serde_base; pub mod serde; use std::fmt; -use std::io::{Read, Seek, SeekFrom}; -use std::io::Error as IoError; +use std::io::{self, Read, Seek, SeekFrom}; /// An encoding of a plist as a flat structure. /// @@ -116,13 +115,13 @@ pub enum PlistEvent { StringValue(String), } -pub type Result<T> = ::std::result::Result<T, Error>; +type Result<T> = ::std::result::Result<T, Error>; #[derive(Debug)] pub enum Error { InvalidData, UnexpectedEof, - Io(IoError), + Io(io::Error), Serde(String), } @@ -153,8 +152,8 @@ impl fmt::Display for Error { } } -impl From<IoError> for Error { - fn from(err: IoError) -> Error { +impl From<io::Error> for Error { + fn from(err: io::Error) -> Error { Error::Io(err) } } diff --git a/tests/fuzzer.rs b/tests/fuzzer.rs index 8ed21f2..539c689 100644 --- a/tests/fuzzer.rs +++ b/tests/fuzzer.rs @@ -1,7 +1,7 @@ extern crate plist; +use plist::{Error, Plist}; use std::io::Cursor; -use plist::{Plist, Result}; #[test] fn too_large_allocation() { @@ -59,7 +59,7 @@ fn issue_22_binary_with_byte_ref_size() { test_fuzzer_data_ok(data); } -fn test_fuzzer_data(data: &[u8]) -> Result<Plist> { +fn test_fuzzer_data(data: &[u8]) -> Result<Plist, Error> { let cursor = Cursor::new(data); Plist::read(cursor) } diff --git a/tests/serde_tests/mod.rs b/tests/serde_tests/mod.rs index c4b8c4a..d908f08 100644 --- a/tests/serde_tests/mod.rs +++ b/tests/serde_tests/mod.rs @@ -1,6 +1,6 @@ -use plist::{Date, EventWriter, PlistEvent, Result as PlistResult}; -use plist::serde::{Deserializer, Serializer}; use plist::PlistEvent::*; +use plist::serde::{Deserializer, Serializer}; +use plist::{Date, Error, EventWriter, PlistEvent}; use serde::de::DeserializeOwned; use serde::ser::Serialize; use std::fmt::Debug; @@ -21,7 +21,7 @@ impl VecWriter { } impl EventWriter for VecWriter { - fn write(&mut self, event: &PlistEvent) -> PlistResult<()> { + fn write(&mut self, event: &PlistEvent) -> Result<(), Error> { self.events.push(event.clone()); Ok(()) } @@ -31,7 +31,7 @@ fn new_serializer() -> Serializer<VecWriter> { Serializer::new(VecWriter::new()) } -fn new_deserializer(events: Vec<PlistEvent>) -> Deserializer<Vec<PlistResult<PlistEvent>>> { +fn new_deserializer(events: Vec<PlistEvent>) -> Deserializer<Vec<Result<PlistEvent, Error>>> { let result_events = events.into_iter().map(Ok).collect(); Deserializer::new(result_events) } |
