diff options
| author | Edward Barnard | 2018-04-30 13:08:28 +0100 | 
|---|---|---|
| committer | Edward Barnard | 2018-05-01 10:44:45 +0100 | 
| commit | 99860e4ee260cd072b8c261b85edb27d5af6c204 (patch) | |
| tree | 9b9a816999dfb9b47844d172f1e254cfec2fd2f6 | |
| parent | a4963e97eff1fd7d465854f2a5e9a155b60c7ab2 (diff) | |
| download | rust-plist-99860e4ee260cd072b8c261b85edb27d5af6c204.tar.bz2 | |
Improve doc output by not renaming std::io::Error to IoError and not creating a public type alias for Result<T, Error>.
| -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)  } | 
