Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove deprecated Error::description #197

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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