Skip to content

Commit

Permalink
Merge pull request #69 from thomaseizinger/better-error-impl
Browse files Browse the repository at this point in the history
Override `source` in the Error impl; MSRV 1.31
  • Loading branch information
cuviper authored Jun 24, 2022
2 parents cc9187f + e94cd7b commit 1ca4686
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
11 changes: 4 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,13 @@ jobs:
fail-fast: false
matrix:
rust:
- 1.31.0 # MSRV
- stable
- beta
- nightly
features:
- ""
- "serde"
include:
- rust: 1.12.0 # MSRV
features: ""

steps:
- name: Checkout
Expand All @@ -34,12 +32,11 @@ jobs:
toolchain: ${{ matrix.rust }}
override: true

- name: (1.12.0) Downgrade serde
if: ${{ matrix.rust == '1.12.0' }}
- name: (1.31.0) Downgrade serde_json
if: ${{ matrix.rust == '1.31.0' }}
run: |
cargo generate-lockfile
cargo update -p serde_json --precise 1.0.0
cargo update -p serde --precise 1.0.0
cargo update -p serde_json --precise 1.0.39
- name: Build
uses: actions-rs/cargo@v1
Expand Down
4 changes: 4 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1059,6 +1059,10 @@ where
L: Error,
R: Error,
{
fn source(&self) -> Option<&(dyn Error + 'static)> {
for_both!(*self, ref inner => inner.source())
}

#[allow(deprecated)]
fn description(&self) -> &str {
for_both!(*self, ref inner => inner.description())
Expand Down
1 change: 1 addition & 0 deletions src/serde_untagged.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
//! but in typical cases Vec<String> would suffice, too.
//!
//! ```rust
//! extern crate either;
//! #[macro_use]
//! extern crate serde;
//! // or `use serde::{Serialize, Deserialize};` in newer rust versions.
Expand Down
1 change: 1 addition & 0 deletions src/serde_untagged_optional.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
//! but in typical cases Vec<String> would suffice, too.
//!
//! ```rust
//! extern crate either;
//! #[macro_use]
//! extern crate serde;
//! // or `use serde::{Serialize, Deserialize};` in newer rust versions.
Expand Down

0 comments on commit 1ca4686

Please sign in to comment.