Skip to content

Commit

Permalink
Merge pull request #197 from AnderEnder/remove-deprecated-error-descr…
Browse files Browse the repository at this point in the history
…iption

Remove deprecated Error::description
  • Loading branch information
steveklabnik authored Mar 15, 2020
2 parents 15189a1 + 13e9e54 commit e635255
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 15 deletions.
8 changes: 1 addition & 7 deletions src/version.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,13 +193,7 @@ impl fmt::Display for SemVerError {
}
}

impl Error for SemVerError {
fn description(&self) -> &str {
match self {
&SemVerError::ParseError(ref m) => m,
}
}
}
impl Error for SemVerError {}

/// A Result type for errors
pub type Result<T> = result::Result<T, SemVerError>;
Expand Down
13 changes: 5 additions & 8 deletions src/version_req.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,13 +167,7 @@ pub enum ReqParseError {

impl fmt::Display for ReqParseError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
self.description().fmt(f)
}
}

impl Error for ReqParseError {
fn description(&self) -> &str {
match self {
let msg = match self {
&InvalidVersionRequirement => "the given version requirement is invalid",
&OpAlreadySet => {
"you have already provided an operation, such as =, ~, or ^; only use one"
Expand All @@ -186,10 +180,13 @@ impl Error for ReqParseError {
"the given version requirement is not implemented, yet"
}
&DeprecatedVersionRequirement(_) => "This requirement is deprecated",
}
};
msg.fmt(f)
}
}

impl Error for ReqParseError {}

impl From<String> for ReqParseError {
fn from(other: String) -> ReqParseError {
match &*other {
Expand Down

0 comments on commit e635255

Please sign in to comment.