Skip to content

Commit

Permalink
Shorten IoError to Io for some variants
Browse files Browse the repository at this point in the history
  • Loading branch information
madig committed Nov 26, 2021
1 parent 2902eb8 commit ac0bb45
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ pub enum Error {
#[derive(Debug)]
pub enum GlifLoadError {
/// An [`std::io::Error`].
IoError(IoError),
Io(IoError),
/// A [`quick_xml::Error`].
Xml(XmlError),
/// The .glif file was malformed.
Expand Down Expand Up @@ -132,7 +132,7 @@ pub enum WriteError {
/// If for some reason the implementation of that crate changes, we could
/// be affected, although this is very unlikely.
InternalLibWriteError,
IoError(IoError),
Io(IoError),
Plist(PlistError),
}

Expand Down Expand Up @@ -241,7 +241,7 @@ impl std::fmt::Display for GlifLoadError {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
match self {
GlifLoadError::Xml(err) => err.fmt(f),
GlifLoadError::IoError(err) => err.fmt(f),
GlifLoadError::Io(err) => err.fmt(f),
GlifLoadError::Parse(err) => err.fmt(f),
}
}
Expand Down Expand Up @@ -334,7 +334,7 @@ impl std::fmt::Display for ErrorKind {
impl std::fmt::Display for WriteError {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
match self {
WriteError::IoError(err) => err.fmt(f),
WriteError::Io(err) => err.fmt(f),
WriteError::Xml(err) => err.fmt(f),
WriteError::Plist(err) => err.fmt(f),
WriteError::InternalLibWriteError => {
Expand All @@ -353,7 +353,7 @@ impl std::fmt::Display for GlifWriteError {
impl std::error::Error for WriteError {
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
match self {
WriteError::IoError(inner) => Some(inner),
WriteError::Io(inner) => Some(inner),
WriteError::Xml(inner) => Some(inner),
WriteError::Plist(inner) => Some(inner),
WriteError::InternalLibWriteError => None,
Expand Down Expand Up @@ -417,7 +417,7 @@ impl From<XmlError> for WriteError {
#[doc(hidden)]
impl From<IoError> for WriteError {
fn from(src: IoError) -> WriteError {
WriteError::IoError(src)
WriteError::Io(src)
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/glyph/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ impl Glyph {

pub fn load_with_names(path: &Path, names: &NameList) -> Result<Self, GlifLoadError> {
std::fs::read(path)
.map_err(GlifLoadError::IoError)
.map_err(GlifLoadError::Io)
.and_then(|data| parse::GlifParser::from_xml(&data, Some(names)))
}

Expand Down

0 comments on commit ac0bb45

Please sign in to comment.