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NU7SMEJQXFQBAHWAC
IPMYODUQCBXWWBP23CX5LCGRKEOOX7UCKYJALNPFS7DCX6NL4R7AC
SG6KZY4MUKOBPA7BBFRGGZIP36HWQ3WXJACMLBCZ57RX2HCWHWRQC
4OGIZN3K7Q53QWSYTZPTDBZGI7K26ZE4S3UD2763Q4MVYLNU3V6QC
QC7NT7OSHSES2YXEDEGK7JLCEGZCNQVC7ATCYQMV7BA4IVJCHOAAC
XRD42IPQNR7ZIUUFEDXZV7GHHGTG725FSCNJOROZSGYYRAKTVWVAC
CRSOWJH2FLUWC6ZJDOYFN4QQP2VKRDWSDNCH3FLYJRYJSN5KWXNAC
language: rust
rust:
- nightly
- beta
- stable
script:
- cargo test
- cargo check --no-default-features
matrix:
include:
- rust: 1.34.0
script: cargo check
- rust: 1.36.0
script: cargo check --no-default-features
- rust: nightly
name: Clippy
script:
- rustup component add clippy || travis_terminate 0
- cargo clippy -- -Dclippy::all
on: [push, pull_request]
name: Continuous integration
jobs:
check:
name: Check
runs-on: ubuntu-latest
strategy:
matrix:
rust:
- stable
- 1.31.0
steps:
- uses: actions/checkout@v1
- uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
override: true
- uses: actions-rs/cargo@v1
with:
command: check
test:
name: Test Suite
runs-on: ubuntu-latest
strategy:
matrix:
rust:
- stable
- nightly
- 1.31.0
steps:
- uses: actions/checkout@v1
- uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
override: true
- uses: actions-rs/cargo@v1
with:
command: test
- uses: actions-rs/cargo@v1
with:
command: test
args: --no-default-features
fmt:
name: Rustfmt
runs-on: ubuntu-latest
strategy:
matrix:
rust:
- stable
- 1.31.0
steps:
- uses: actions/checkout@v1
- uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
override: true
- run: rustup component add rustfmt
- uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
clippy:
name: Clippy
runs-on: ubuntu-latest
strategy:
matrix:
rust:
- stable
- 1.31.0
steps:
- uses: actions/checkout@v1
- uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
override: true
- run: rustup component add clippy
- uses: actions-rs/cargo@v1
with:
command: clippy
args: -- -D warnings
This library provides [`eyre::Error`][Error], a trait object based error type
for easy idiomatic error handling in Rust applications.
This library provides [`eyre::ErrReport`][ErrReport], a trait object based
error handling type for easy idiomatic error handling and reporting in Rust
applications.
write!(f, "{}", self.error())?;
if f.alternate() {
for cause in self.chain().skip(1) {
write!(f, ": {}", cause)?;
}
}
Ok(())
self.context.display(self.error(), f)
let error = self.error();
if f.alternate() {
return Debug::fmt(error, f);
}
write!(f, "{}", error)?;
if let Some(cause) = error.source() {
write!(f, "\n\nCaused by:")?;
let multiple = cause.source().is_some();
for (n, error) in Chain::new(cause).enumerate() {
writeln!(f)?;
let mut indented = Indented {
inner: f,
number: if multiple { Some(n) } else { None },
started: false,
};
write!(indented, "{}", error)?;
}
}
#[cfg(backtrace)]
{
use std::backtrace::BacktraceStatus;
let backtrace = self.backtrace();
if let BacktraceStatus::Captured = backtrace.status() {
let mut backtrace = backtrace.to_string();
if backtrace.starts_with("stack backtrace:") {
// Capitalize to match "Caused by:"
backtrace.replace_range(0..1, "S");
}
backtrace.truncate(backtrace.trim_end().len());
write!(f, "\n\n{}", backtrace)?;
}
}
Ok(())
self.context.debug(self.error(), f)
struct Indented<'a, D> {
inner: &'a mut D,
number: Option<usize>,
started: bool,
pub(crate) struct Indented<'a, D> {
pub(crate) inner: &'a mut D,
pub(crate) number: Option<usize>,
pub(crate) started: bool,
}
}
fn display(&self, error: &(dyn std::error::Error + 'static), f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
write!(f, "{}", error)?;
if f.alternate() {
for cause in Chain::new(error).skip(1) {
write!(f, ": {}", cause)?;
}
}
Ok(())
}
fn debug(&self, error: &(dyn std::error::Error + 'static), f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
use core::fmt::Write as _;
if f.alternate() {
return core::fmt::Debug::fmt(error, f);
}
write!(f, "{}", error)?;
if let Some(cause) = error.source() {
write!(f, "\n\nCaused by:")?;
let multiple = cause.source().is_some();
for (n, error) in Chain::new(cause).enumerate() {
writeln!(f)?;
let mut indented = fmt::Indented {
inner: f,
number: if multiple { Some(n) } else { None },
started: false,
};
write!(indented, "{}", error)?;
}
}
#[cfg(backtrace)]
{
use std::backtrace::BacktraceStatus;
let backtrace = self.backtrace.as_ref().or_else(|| error.backtrace()).expect("backtrace capture failed");
if let BacktraceStatus::Captured = backtrace.status() {
let mut backtrace = backtrace.to_string();
if backtrace.starts_with("stack backtrace:") {
// Capitalize to match "Caused by:"
backtrace.replace_range(0..1, "S");
}
backtrace.truncate(backtrace.trim_end().len());
write!(f, "\n\n{}", backtrace)?;
}