Skip to content

Commit

Permalink
deprecated: allow use of deprecated description methods
Browse files Browse the repository at this point in the history
PR #633 removed these methods, but we can't do that without making a
breaking change release. Removing deprecated methods isn't worth doing a
breaking change release, so we instead simply allow them for now by
squashing the warnings.

Closes #633
  • Loading branch information
BurntSushi committed Jan 9, 2020
1 parent 27c0d6d commit 9ac0f5e
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 0 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
1.3.2 (2020-01-09)
==================
This is a small maintenance release with some house cleaning and bug fixes.

Bug fixes:

* [BUG #633](https://github.com/rust-lang/regex/pull/633):
Squash deprecation warnings for the `std::error::Error::description` method.


1.3.1 (2019-09-04)
==================
This is a maintenance release with no changes in order to try to work-around
Expand Down
2 changes: 2 additions & 0 deletions regex-syntax/src/ast/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,8 @@ pub enum ErrorKind {
}

impl error::Error for Error {
// TODO: Remove this method entirely on the next breaking semver release.
#[allow(deprecated)]
fn description(&self) -> &str {
use self::ErrorKind::*;
match self.kind {
Expand Down
2 changes: 2 additions & 0 deletions regex-syntax/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ impl From<hir::Error> for Error {
}

impl error::Error for Error {
// TODO: Remove this method entirely on the next breaking semver release.
#[allow(deprecated)]
fn description(&self) -> &str {
match *self {
Error::Parse(ref x) => x.description(),
Expand Down
6 changes: 6 additions & 0 deletions regex-syntax/src/hir/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ pub enum ErrorKind {
}

impl ErrorKind {
// TODO: Remove this method entirely on the next breaking semver release.
#[allow(deprecated)]
fn description(&self) -> &str {
use self::ErrorKind::*;
match *self {
Expand All @@ -113,6 +115,8 @@ impl ErrorKind {
}

impl error::Error for Error {
// TODO: Remove this method entirely on the next breaking semver release.
#[allow(deprecated)]
fn description(&self) -> &str {
self.kind.description()
}
Expand All @@ -126,6 +130,8 @@ impl fmt::Display for Error {

impl fmt::Display for ErrorKind {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
// TODO: Remove this on the next breaking semver release.
#[allow(deprecated)]
f.write_str(self.description())
}
}
Expand Down
2 changes: 2 additions & 0 deletions src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ pub enum Error {
}

impl ::std::error::Error for Error {
// TODO: Remove this method entirely on the next breaking semver release.
#[allow(deprecated)]
fn description(&self) -> &str {
match *self {
Error::Syntax(ref err) => err,
Expand Down

0 comments on commit 9ac0f5e

Please sign in to comment.