From 92577f7fefad637192c463472848d5e3008948eb Mon Sep 17 00:00:00 2001 From: Jane Lusby Date: Wed, 5 Feb 2020 08:04:00 -0800 Subject: [PATCH 01/11] Initial commit --- .gitignore | 2 ++ Cargo.toml | 21 +++++++++++++ README.md | 52 ++++++++++++++++++++++++++++++++ rust-toolchain | 1 + src/lib.rs | 82 ++++++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 158 insertions(+) create mode 100644 .gitignore create mode 100644 Cargo.toml create mode 100644 README.md create mode 100644 rust-toolchain create mode 100644 src/lib.rs diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..96ef6c0 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/target +Cargo.lock diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..da23a6b --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,21 @@ +[package] +name = "simple-eyre" +version = "0.1.0" +authors = ["Jane Lusby "] +edition = "2018" +license = "MIT OR Apache-2.0" +readme = "README.md" +repository = "https://github.com/yaahc/simple-eyre" +homepage = "https://github.com/yaahc/simple-eyre" +documentation = "https://docs.rs/simple-eyre" +keywords = ["error"] +description = """ +One of the simplest error types one can build ontop of eyre, including only an +inner error boxed as a trait object and a context with only a Backtrace +""" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +eyre-impl = "0.1.0" +thiserror = "1.0.10" diff --git a/README.md b/README.md new file mode 100644 index 0000000..a68085a --- /dev/null +++ b/README.md @@ -0,0 +1,52 @@ +Simple-Eyre +=========== + +[![Latest Version](https://img.shields.io/crates/v/simple-eyre.svg)](https://crates.io/crates/simple-eyre) +[![Rust Documentation](https://img.shields.io/badge/api-rustdoc-blue.svg)](https://docs.rs/simple-eyre) + +```toml +[dependencies] +simple-eyre = "0.1" +``` + +
+ +## Example + +```rust +fn eyre::ErrReport; + +fn find_git_root() -> Result { + find_dir_in_ancestors(".git")?; +} +``` + +
+ +## Details + +- This library is meant to be used as a minimal example of how to use + `eyre-impl`. It implements the absolute minimum necessary to function as a + dynamic error wrapper that associates some context with it. In this case the + context is only a Backtrace. + +
+ +#### License + + +Licensed under either of Apache License, Version +2.0 or MIT license at your option. + + +
+ + +Unless you explicitly state otherwise, any contribution intentionally submitted +for inclusion in this crate by you, as defined in the Apache-2.0 license, shall +be dual licensed as above, without any additional terms or conditions. + + + + + diff --git a/rust-toolchain b/rust-toolchain new file mode 100644 index 0000000..bf867e0 --- /dev/null +++ b/rust-toolchain @@ -0,0 +1 @@ +nightly diff --git a/src/lib.rs b/src/lib.rs new file mode 100644 index 0000000..d049493 --- /dev/null +++ b/src/lib.rs @@ -0,0 +1,82 @@ +#![feature(backtrace)] +use eyre_impl::{ErrorReporter, Indented}; +use std::backtrace::{Backtrace, BacktraceStatus}; +use std::fmt::{self, Write as _}; + +#[derive(Debug)] +pub struct BoxError(Box); + +impl std::error::Error for BoxError { + fn source(&self) -> Option<&(dyn std::error::Error + 'static)> { + self.0.source() + } +} + +impl fmt::Display for BoxError { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fmt::Display::fmt(&self.0, f) + } +} + +pub struct Context { + backtrace: Backtrace, +} + +impl Default for Context { + fn default() -> Self { + Self { + backtrace: Backtrace::capture(), + } + } +} + +pub struct ErrReport(ErrorReporter); + +impl From for ErrReport +where + E: std::error::Error + Send + Sync + 'static, +{ + fn from(err: E) -> Self { + ErrReport(ErrorReporter::from(BoxError(Box::new(err)))) + } +} + +impl fmt::Debug for ErrReport { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + let error = &self.0.error; + + if f.alternate() { + return fmt::Debug::fmt(error, f); + } + + let errors = self.0.chain().rev().enumerate(); + + writeln!(f)?; + + for (n, error) in errors { + write!(Indented::numbered(f, n), "{}", error)?; + writeln!(f)?; + } + + let backtrace = &self.0.context.backtrace; + if let BacktraceStatus::Captured = backtrace.status() { + write!(f, "\n\n{}", backtrace)?; + } + + Ok(()) + } +} + +impl fmt::Display for ErrReport { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "{}", self.0.error)?; + + if f.alternate() { + for cause in self.0.chain().skip(1) { + write!(f, ": {}", cause)?; + } + } + + Ok(()) + } +} From 01e30fd4d6d9358273003ab4d5dacb875c342391 Mon Sep 17 00:00:00 2001 From: Jane Lusby Date: Mon, 18 May 2020 08:28:02 -0700 Subject: [PATCH 02/11] switch from using eyre prototype to actual eyre (#1) - add ci - update docs - set default lints - bump version for new release --- .github/workflows/ci.yml | 121 ++++++++++++++++++++++++++++ Cargo.toml | 11 +-- README.md | 28 +++---- src/lib.rs | 170 +++++++++++++++++++++++---------------- 4 files changed, 241 insertions(+), 89 deletions(-) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..f6a7b52 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,121 @@ +on: + push: + branches: + - master + pull_request: {} + +name: Continuous integration + +jobs: + check: + name: Check + runs-on: ubuntu-latest + strategy: + matrix: + rust: + - stable + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + toolchain: ${{ matrix.rust }} + override: true + - uses: actions-rs/cargo@v1 + with: + command: check + + test-features: + name: Test Suite + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + toolchain: stable + override: true + - uses: actions-rs/cargo@v1 + with: + command: test + - uses: actions-rs/cargo@v1 + with: + command: test + args: --all-features + - uses: actions-rs/cargo@v1 + with: + command: test + args: --no-default-features + + test-versions: + name: Test Suite + runs-on: ubuntu-latest + strategy: + matrix: + rust: + - stable + - beta + - nightly + - 1.39.0 + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + toolchain: ${{ matrix.rust }} + override: true + - uses: actions-rs/cargo@v1 + with: + command: test + + test-os: + name: Test Suite + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, windows-latest, macOS-latest] + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + toolchain: stable + override: true + profile: minimal + - uses: actions-rs/cargo@v1 + with: + command: test + + fmt: + name: Rustfmt + runs-on: ubuntu-latest + strategy: + matrix: + rust: + - stable + steps: + - uses: actions/checkout@v2 + - 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 + 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: --all-targets --all-features -- -D warnings diff --git a/Cargo.toml b/Cargo.toml index da23a6b..656d278 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "simple-eyre" -version = "0.1.0" +version = "0.2.0" authors = ["Jane Lusby "] edition = "2018" license = "MIT OR Apache-2.0" @@ -10,12 +10,9 @@ homepage = "https://github.com/yaahc/simple-eyre" documentation = "https://docs.rs/simple-eyre" keywords = ["error"] description = """ -One of the simplest error types one can build ontop of eyre, including only an -inner error boxed as a trait object and a context with only a Backtrace +One of the simplest error reporters one can build ontop of eyre, defining only an error report """ -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - [dependencies] -eyre-impl = "0.1.0" -thiserror = "1.0.10" +eyre = "0.4.2" +indenter = "0.3.0" diff --git a/README.md b/README.md index a68085a..523f8c9 100644 --- a/README.md +++ b/README.md @@ -4,9 +4,14 @@ Simple-Eyre [![Latest Version](https://img.shields.io/crates/v/simple-eyre.svg)](https://crates.io/crates/simple-eyre) [![Rust Documentation](https://img.shields.io/badge/api-rustdoc-blue.svg)](https://docs.rs/simple-eyre) +This library provides a custom [`eyre::EyreContext`] type for usage with +[`eyre`] that provides a minimal error report with no additional context. +Essentially the minimal implementation of an error reporter. + ```toml [dependencies] -simple-eyre = "0.1" +eyre = "0.4" +simple-eyre = "0.2" ```
@@ -14,22 +19,18 @@ simple-eyre = "0.1" ## Example ```rust -fn eyre::ErrReport; +use eyre::{eyre, WrapErr}; +use simple_eyre::Report; + +fn main() -> Result<(), Report> { + let e: Report = eyre!("oh no this program is just bad!"); -fn find_git_root() -> Result { - find_dir_in_ancestors(".git")?; + Err(e).wrap_err("usage example successfully experienced a failure") } ```
-## Details - -- This library is meant to be used as a minimal example of how to use - `eyre-impl`. It implements the absolute minimum necessary to function as a - dynamic error wrapper that associates some context with it. In this case the - context is only a Backtrace. -
#### License @@ -47,6 +48,5 @@ for inclusion in this crate by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions. - - - +[`eyre::EyreContext`]: https://docs.rs/eyre/*/eyre/trait.EyreContext.html +[`eyre`]: https://docs.rs/eyre diff --git a/src/lib.rs b/src/lib.rs index d049493..c418f08 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,82 +1,116 @@ -#![feature(backtrace)] -use eyre_impl::{ErrorReporter, Indented}; -use std::backtrace::{Backtrace, BacktraceStatus}; -use std::fmt::{self, Write as _}; - +//! This library provides a custom [`eyre::EyreContext`] type for usage with [`eyre`] that provides +//! a minimal error report with no additional context. Essentially the minimal implementation of an +//! error reporter. +//! +//! # Example +//! +//! ```rust,should_panic +//! use eyre::{eyre, WrapErr}; +//! use simple_eyre::Report; +//! +//! fn main() -> Result<(), Report> { +//! let e: Report = eyre!("oh no this program is just bad!"); +//! +//! Err(e).wrap_err("usage example successfully experienced a failure") +//! } +//! ``` +//! +//! [`eyre::EyreContext`]: https://docs.rs/eyre/*/eyre/trait.EyreContext.html +//! [`eyre`]: https://docs.rs/eyre +#![doc(html_root_url = "https://docs.rs/simple-eyre/0.2.0")] +#![warn( + missing_debug_implementations, + missing_docs, + missing_doc_code_examples, + rust_2018_idioms, + unreachable_pub, + bad_style, + const_err, + dead_code, + improper_ctypes, + non_shorthand_field_patterns, + no_mangle_generic_items, + overflowing_literals, + path_statements, + patterns_in_fns_without_body, + private_in_public, + unconditional_recursion, + unused, + unused_allocation, + unused_comparisons, + unused_parens, + while_true +)] +use eyre::Chain; +use eyre::EyreContext; +use indenter::indented; +use std::error::Error; + +/// A custom context type for minimal error reporting via `eyre` #[derive(Debug)] -pub struct BoxError(Box); - -impl std::error::Error for BoxError { - fn source(&self) -> Option<&(dyn std::error::Error + 'static)> { - self.0.source() - } -} - -impl fmt::Display for BoxError { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - fmt::Display::fmt(&self.0, f) - } -} - -pub struct Context { - backtrace: Backtrace, -} - -impl Default for Context { - fn default() -> Self { - Self { - backtrace: Backtrace::capture(), - } - } -} - -pub struct ErrReport(ErrorReporter); +pub struct Context; -impl From for ErrReport -where - E: std::error::Error + Send + Sync + 'static, -{ - fn from(err: E) -> Self { - ErrReport(ErrorReporter::from(BoxError(Box::new(err)))) +impl EyreContext for Context { + #[allow(unused_variables)] + fn default(error: &(dyn Error + 'static)) -> Self { + Self } -} -impl fmt::Debug for ErrReport { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - let error = &self.0.error; + fn debug( + &self, + error: &(dyn Error + 'static), + f: &mut core::fmt::Formatter<'_>, + ) -> core::fmt::Result { + use core::fmt::Write as _; if f.alternate() { - return fmt::Debug::fmt(error, f); - } - - let errors = self.0.chain().rev().enumerate(); - - writeln!(f)?; - - for (n, error) in errors { - write!(Indented::numbered(f, n), "{}", error)?; - writeln!(f)?; - } - - let backtrace = &self.0.context.backtrace; - if let BacktraceStatus::Captured = backtrace.status() { - write!(f, "\n\n{}", backtrace)?; + return core::fmt::Debug::fmt(error, f); } - Ok(()) - } -} - -impl fmt::Display for ErrReport { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "{}", self.0.error)?; - - if f.alternate() { - for cause in self.0.chain().skip(1) { - write!(f, ": {}", cause)?; + 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)?; + if multiple { + write!(indented(f).ind(n), "{}", error)?; + } else { + write!(indented(f), "{}", error)?; + } } } Ok(()) } } + +/// A type alias for `eyre::Report` +/// +/// # Example +/// +/// ```rust +/// use simple_eyre::Report; +/// +/// # struct Config; +/// fn try_thing(path: &str) -> Result { +/// // ... +/// # Ok(Config) +/// } +/// ``` +pub type Report = eyre::Report; + +/// A type alias for `Result` +/// +/// # Example +/// +///``` +/// fn main() -> simple_eyre::Result<()> { +/// +/// // ... +/// +/// Ok(()) +/// } +/// ``` +pub type Result = core::result::Result; From 758d7a65c7e0ac30b462ac0066052e1883e8858c Mon Sep 17 00:00:00 2001 From: Jane Lusby Date: Mon, 18 May 2020 08:31:59 -0700 Subject: [PATCH 03/11] remove rust-toolchain file --- rust-toolchain | 1 - 1 file changed, 1 deletion(-) delete mode 100644 rust-toolchain diff --git a/rust-toolchain b/rust-toolchain deleted file mode 100644 index bf867e0..0000000 --- a/rust-toolchain +++ /dev/null @@ -1 +0,0 @@ -nightly From 29b78043929f0970fa87474d30bc7ff0cb212c00 Mon Sep 17 00:00:00 2001 From: Jane Lusby Date: Mon, 18 May 2020 08:32:46 -0700 Subject: [PATCH 04/11] remove br from readme --- README.md | 6 ------ 1 file changed, 6 deletions(-) diff --git a/README.md b/README.md index 523f8c9..87c45b8 100644 --- a/README.md +++ b/README.md @@ -14,8 +14,6 @@ eyre = "0.4" simple-eyre = "0.2" ``` -
- ## Example ```rust @@ -29,10 +27,6 @@ fn main() -> Result<(), Report> { } ``` -
- -
- #### License From d7dec31aa740c5dac2393ea706802314ef6f50f1 Mon Sep 17 00:00:00 2001 From: Jane Lusby Date: Mon, 13 Jul 2020 11:45:43 -0700 Subject: [PATCH 05/11] release new version of simple-eyre --- Cargo.toml | 4 +-- README.md | 33 +++++++++++++---------- src/lib.rs | 79 ++++++++++++++++++++++++++++-------------------------- 3 files changed, 62 insertions(+), 54 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 656d278..9b76f37 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "simple-eyre" -version = "0.2.0" +version = "0.3.0" authors = ["Jane Lusby "] edition = "2018" license = "MIT OR Apache-2.0" @@ -14,5 +14,5 @@ One of the simplest error reporters one can build ontop of eyre, defining only a """ [dependencies] -eyre = "0.4.2" +eyre = "0.6.0" indenter = "0.3.0" diff --git a/README.md b/README.md index 87c45b8..466f644 100644 --- a/README.md +++ b/README.md @@ -1,32 +1,40 @@ -Simple-Eyre -=========== +## simple-eyre [![Latest Version](https://img.shields.io/crates/v/simple-eyre.svg)](https://crates.io/crates/simple-eyre) [![Rust Documentation](https://img.shields.io/badge/api-rustdoc-blue.svg)](https://docs.rs/simple-eyre) -This library provides a custom [`eyre::EyreContext`] type for usage with -[`eyre`] that provides a minimal error report with no additional context. -Essentially the minimal implementation of an error reporter. +This library provides a custom [`eyre::EyreHandler`] type for usage with [`eyre`] that provides +a minimal error report with no additional context. Essentially the minimal implementation of an +error reporter. + +## Setup + +Add the following to your toml file: ```toml [dependencies] -eyre = "0.4" -simple-eyre = "0.2" +simple-eyre = "0.3" ``` -## Example +Then install the hook handler before constructing any `eyre::Report` types. -```rust -use eyre::{eyre, WrapErr}; -use simple_eyre::Report; +# Example + +```rust,should_panic +use simple_eyre::eyre::{eyre, WrapErr, Report}; fn main() -> Result<(), Report> { + simple_eyre::install()?; + let e: Report = eyre!("oh no this program is just bad!"); Err(e).wrap_err("usage example successfully experienced a failure") } ``` +[`eyre::EyreHandler`]: https://docs.rs/eyre/*/eyre/trait.EyreHandler.html +[`eyre`]: https://docs.rs/eyre + #### License @@ -41,6 +49,3 @@ Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this crate by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions. - -[`eyre::EyreContext`]: https://docs.rs/eyre/*/eyre/trait.EyreContext.html -[`eyre`]: https://docs.rs/eyre diff --git a/src/lib.rs b/src/lib.rs index c418f08..7db068f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,21 +1,33 @@ -//! This library provides a custom [`eyre::EyreContext`] type for usage with [`eyre`] that provides +//! This library provides a custom [`eyre::EyreHandler`] type for usage with [`eyre`] that provides //! a minimal error report with no additional context. Essentially the minimal implementation of an //! error reporter. //! +//! ## Setup +//! +//! Add the following to your toml file: +//! +//! ```toml +//! [dependencies] +//! simple-eyre = "0.3" +//! ``` +//! +//! Then install the hook handler before constructing any `eyre::Report` types. +//! //! # Example //! //! ```rust,should_panic -//! use eyre::{eyre, WrapErr}; -//! use simple_eyre::Report; +//! use simple_eyre::eyre::{eyre, WrapErr, Report}; //! //! fn main() -> Result<(), Report> { +//! simple_eyre::install()?; +//! //! let e: Report = eyre!("oh no this program is just bad!"); //! //! Err(e).wrap_err("usage example successfully experienced a failure") //! } //! ``` //! -//! [`eyre::EyreContext`]: https://docs.rs/eyre/*/eyre/trait.EyreContext.html +//! [`eyre::EyreHandler`]: https://docs.rs/eyre/*/eyre/trait.EyreHandler.html //! [`eyre`]: https://docs.rs/eyre #![doc(html_root_url = "https://docs.rs/simple-eyre/0.2.0")] #![warn( @@ -41,21 +53,19 @@ unused_parens, while_true )] -use eyre::Chain; -use eyre::EyreContext; +pub use eyre; +#[doc(hidden)] +pub use eyre::{Report, Result}; + +use eyre::EyreHandler; use indenter::indented; use std::error::Error; /// A custom context type for minimal error reporting via `eyre` #[derive(Debug)] -pub struct Context; - -impl EyreContext for Context { - #[allow(unused_variables)] - fn default(error: &(dyn Error + 'static)) -> Self { - Self - } +pub struct Handler; +impl EyreHandler for Handler { fn debug( &self, error: &(dyn Error + 'static), @@ -71,9 +81,13 @@ impl EyreContext for Context { 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() { + let errors = std::iter::successors(Some(cause), |e| e.source()); + + for (n, error) in errors.enumerate() { writeln!(f)?; + if multiple { write!(indented(f).ind(n), "{}", error)?; } else { @@ -86,31 +100,20 @@ impl EyreContext for Context { } } -/// A type alias for `eyre::Report` +/// Install the `simple-eyre` hook as the global error report hook. /// -/// # Example +/// # Details /// -/// ```rust -/// use simple_eyre::Report; +/// This function must be called to enable the customization of `eyre::Report` +/// provided by `simple-eyre`. This function should be called early, ideally +/// before any errors could be encountered. /// -/// # struct Config; -/// fn try_thing(path: &str) -> Result { -/// // ... -/// # Ok(Config) -/// } -/// ``` -pub type Report = eyre::Report; +/// Only the first install will succeed. Calling this function after another +/// report handler has been installed will cause an error. **Note**: This +/// function _must_ be called before any `eyre::Report`s are constructed to +/// prevent the default handler from being installed. +pub fn install() -> Result<()> { + crate::eyre::set_hook(Box::new(move |_| Box::new(Handler)))?; -/// A type alias for `Result` -/// -/// # Example -/// -///``` -/// fn main() -> simple_eyre::Result<()> { -/// -/// // ... -/// -/// Ok(()) -/// } -/// ``` -pub type Result = core::result::Result; + Ok(()) +} From 14ce120664139fc834ee47700a336e3a9b5f6efd Mon Sep 17 00:00:00 2001 From: "William D. Jones" Date: Thu, 22 Apr 2021 13:28:46 -0400 Subject: [PATCH 06/11] Clone error in closure to prevent compiler lifetime errors. (#3) * Clone error in closure to prevent compiler lifetime errors. * Change clone to explicit deref. Co-authored-by: Jane Lusby --- src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index 7db068f..5877161 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -83,7 +83,7 @@ impl EyreHandler for Handler { write!(f, "\n\nCaused by:")?; let multiple = cause.source().is_some(); - let errors = std::iter::successors(Some(cause), |e| e.source()); + let errors = std::iter::successors(Some(cause), |e| (*e).source()); for (n, error) in errors.enumerate() { writeln!(f)?; From ddfe8d9e4543fa8c2f9209f898458b575c947ced Mon Sep 17 00:00:00 2001 From: Jane Lusby Date: Thu, 24 Jun 2021 15:39:24 -0700 Subject: [PATCH 07/11] prep for new release --- CHANGELOG.md | 15 +++++++++++++++ Cargo.toml | 43 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+) create mode 100644 CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..76201e6 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,15 @@ +# Changelog +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + + + +## [Unreleased] - ReleaseDate +# Fixed +- Fixed lifetime inference error caused by recent `std` change. + + + +[0.3.1]: https://github.com/yaahc/displaydoc/releases/tag/v0.3.1 diff --git a/Cargo.toml b/Cargo.toml index 9b76f37..ac7341a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,3 +16,46 @@ One of the simplest error reporters one can build ontop of eyre, defining only a [dependencies] eyre = "0.6.0" indenter = "0.3.0" + +[package.metadata.docs.rs] +all-features = true +rustdoc-args = ["--cfg", "docsrs"] + +[package.metadata.release] +no-dev-version = true + +[[package.metadata.release.pre-release-replacements]] +file = "CHANGELOG.md" +search = "Unreleased" +replace="{{version}}" + +[[package.metadata.release.pre-release-replacements]] +file = "src/lib.rs" +search = "#!\\[doc\\(html_root_url.*" +replace = "#![doc(html_root_url = \"https://docs.rs/{{crate_name}}/{{version}}\")]" +exactly = 1 + +[[package.metadata.release.pre-release-replacements]] +file = "CHANGELOG.md" +search = "ReleaseDate" +replace="{{date}}" + +[[package.metadata.release.pre-release-replacements]] +file="CHANGELOG.md" +search="" +replace="\n\n## [Unreleased] - ReleaseDate" +exactly=1 + +# Disable this replacement on the very first release +# [[package.metadata.release.pre-release-replacements]] +# file = "CHANGELOG.md" +# search = "\\.\\.\\.HEAD" +# replace="...{{tag_name}}" +# exactly = 1 +# END SECTION, do not comment out the replacement below this, and do not reorder them + +[[package.metadata.release.pre-release-replacements]] +file="CHANGELOG.md" +search="" +replace="\n[Unreleased]: https://github.com/yaahc/{{crate_name}}/compare/{{tag_name}}...HEAD" +exactly=1 From 013da740a1c879c0bc3d6634091d812e61d8cfd3 Mon Sep 17 00:00:00 2001 From: Jane Lusby Date: Thu, 24 Jun 2021 15:48:55 -0700 Subject: [PATCH 08/11] (cargo-release) version 0.3.1 --- CHANGELOG.md | 3 +++ Cargo.toml | 2 +- src/lib.rs | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 76201e6..36d49a8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,9 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] - ReleaseDate + +## [0.3.1] - 2021-06-24 # Fixed - Fixed lifetime inference error caused by recent `std` change. +[Unreleased]: https://github.com/yaahc/simple-eyre/compare/v0.3.1...HEAD [0.3.1]: https://github.com/yaahc/displaydoc/releases/tag/v0.3.1 diff --git a/Cargo.toml b/Cargo.toml index ac7341a..69ef31c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "simple-eyre" -version = "0.3.0" +version = "0.3.1" authors = ["Jane Lusby "] edition = "2018" license = "MIT OR Apache-2.0" diff --git a/src/lib.rs b/src/lib.rs index 5877161..e9c9e24 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -29,7 +29,7 @@ //! //! [`eyre::EyreHandler`]: https://docs.rs/eyre/*/eyre/trait.EyreHandler.html //! [`eyre`]: https://docs.rs/eyre -#![doc(html_root_url = "https://docs.rs/simple-eyre/0.2.0")] +#![doc(html_root_url = "https://docs.rs/simple-eyre/0.3.1")] #![warn( missing_debug_implementations, missing_docs, From 93603ea33a0046c74fd32127016479ea4be91d1c Mon Sep 17 00:00:00 2001 From: Jane Lusby Date: Thu, 24 Jun 2021 15:49:36 -0700 Subject: [PATCH 09/11] prep for future releases --- Cargo.toml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 69ef31c..6ffb84e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -47,11 +47,11 @@ replace="\n\n## [Unreleased] - ReleaseDate" exactly=1 # Disable this replacement on the very first release -# [[package.metadata.release.pre-release-replacements]] -# file = "CHANGELOG.md" -# search = "\\.\\.\\.HEAD" -# replace="...{{tag_name}}" -# exactly = 1 +[[package.metadata.release.pre-release-replacements]] +file = "CHANGELOG.md" +search = "\\.\\.\\.HEAD" +replace="...{{tag_name}}" +exactly = 1 # END SECTION, do not comment out the replacement below this, and do not reorder them [[package.metadata.release.pre-release-replacements]] From cb81bc44be9f5e84758758e9aef4fd69b5ea75b7 Mon Sep 17 00:00:00 2001 From: Pavan Kumar Sunkara Date: Mon, 8 Apr 2024 21:54:31 +0100 Subject: [PATCH 10/11] Add simple-eyre to workspace --- Cargo.toml | 4 +- simple-eyre/.github/workflows/ci.yml | 121 --------------------------- simple-eyre/.gitignore | 2 - simple-eyre/CHANGELOG.md | 4 +- simple-eyre/Cargo.toml | 20 ++--- simple-eyre/LICENSE-APACHE | 1 + simple-eyre/LICENSE-MIT | 1 + 7 files changed, 15 insertions(+), 138 deletions(-) delete mode 100644 simple-eyre/.github/workflows/ci.yml delete mode 100644 simple-eyre/.gitignore create mode 120000 simple-eyre/LICENSE-APACHE create mode 120000 simple-eyre/LICENSE-MIT diff --git a/Cargo.toml b/Cargo.toml index b58a509..9f1a1fc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,7 +2,8 @@ members = [ "color-eyre", "color-spantrace", - "eyre" + "eyre", + "simple-eyre", ] [workspace.package] @@ -21,4 +22,3 @@ owo-colors = "3.2.0" [profile.dev.package.backtrace] opt-level = 3 - diff --git a/simple-eyre/.github/workflows/ci.yml b/simple-eyre/.github/workflows/ci.yml deleted file mode 100644 index f6a7b52..0000000 --- a/simple-eyre/.github/workflows/ci.yml +++ /dev/null @@ -1,121 +0,0 @@ -on: - push: - branches: - - master - pull_request: {} - -name: Continuous integration - -jobs: - check: - name: Check - runs-on: ubuntu-latest - strategy: - matrix: - rust: - - stable - steps: - - uses: actions/checkout@v2 - - uses: actions-rs/toolchain@v1 - with: - toolchain: ${{ matrix.rust }} - override: true - - uses: actions-rs/cargo@v1 - with: - command: check - - test-features: - name: Test Suite - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - override: true - - uses: actions-rs/cargo@v1 - with: - command: test - - uses: actions-rs/cargo@v1 - with: - command: test - args: --all-features - - uses: actions-rs/cargo@v1 - with: - command: test - args: --no-default-features - - test-versions: - name: Test Suite - runs-on: ubuntu-latest - strategy: - matrix: - rust: - - stable - - beta - - nightly - - 1.39.0 - steps: - - uses: actions/checkout@v2 - - uses: actions-rs/toolchain@v1 - with: - toolchain: ${{ matrix.rust }} - override: true - - uses: actions-rs/cargo@v1 - with: - command: test - - test-os: - name: Test Suite - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [ubuntu-latest, windows-latest, macOS-latest] - steps: - - uses: actions/checkout@v2 - - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - override: true - profile: minimal - - uses: actions-rs/cargo@v1 - with: - command: test - - fmt: - name: Rustfmt - runs-on: ubuntu-latest - strategy: - matrix: - rust: - - stable - steps: - - uses: actions/checkout@v2 - - 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 - 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: --all-targets --all-features -- -D warnings diff --git a/simple-eyre/.gitignore b/simple-eyre/.gitignore deleted file mode 100644 index 96ef6c0..0000000 --- a/simple-eyre/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/target -Cargo.lock diff --git a/simple-eyre/CHANGELOG.md b/simple-eyre/CHANGELOG.md index 36d49a8..f9515ba 100644 --- a/simple-eyre/CHANGELOG.md +++ b/simple-eyre/CHANGELOG.md @@ -14,5 +14,5 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 -[Unreleased]: https://github.com/yaahc/simple-eyre/compare/v0.3.1...HEAD -[0.3.1]: https://github.com/yaahc/displaydoc/releases/tag/v0.3.1 +[Unreleased]: https://github.com/eyre-rs/simple-eyre/compare/v0.3.1...HEAD +[0.3.1]: https://github.com/eyre-rs/simple-eyre/releases/tag/v0.3.1 diff --git a/simple-eyre/Cargo.toml b/simple-eyre/Cargo.toml index 6ffb84e..f6e8ddd 100644 --- a/simple-eyre/Cargo.toml +++ b/simple-eyre/Cargo.toml @@ -1,21 +1,19 @@ [package] name = "simple-eyre" version = "0.3.1" -authors = ["Jane Lusby "] -edition = "2018" -license = "MIT OR Apache-2.0" -readme = "README.md" -repository = "https://github.com/yaahc/simple-eyre" -homepage = "https://github.com/yaahc/simple-eyre" documentation = "https://docs.rs/simple-eyre" -keywords = ["error"] -description = """ -One of the simplest error reporters one can build ontop of eyre, defining only an error report -""" +description = "One of the simplest error reporters one can build ontop of eyre, defining only an error report" + +authors = { workspace = true } +edition = { workspace = true } +license = { workspace = true } +repository = { workspace = true } +readme = { workspace = true } +rust-version = { workspace = true } [dependencies] eyre = "0.6.0" -indenter = "0.3.0" +indenter = { workspace = true } [package.metadata.docs.rs] all-features = true diff --git a/simple-eyre/LICENSE-APACHE b/simple-eyre/LICENSE-APACHE new file mode 120000 index 0000000..965b606 --- /dev/null +++ b/simple-eyre/LICENSE-APACHE @@ -0,0 +1 @@ +../LICENSE-APACHE \ No newline at end of file diff --git a/simple-eyre/LICENSE-MIT b/simple-eyre/LICENSE-MIT new file mode 120000 index 0000000..76219eb --- /dev/null +++ b/simple-eyre/LICENSE-MIT @@ -0,0 +1 @@ +../LICENSE-MIT \ No newline at end of file From 8d9dffabccfc215f43919bed8edf9c05044a8bcf Mon Sep 17 00:00:00 2001 From: Pavan Kumar Sunkara Date: Mon, 8 Apr 2024 21:54:50 +0100 Subject: [PATCH 11/11] Make boilerplate for all crates consistent --- color-eyre/.github/workflows/ci.yml | 72 ----------------------------- color-eyre/Cargo.toml | 40 +++++++--------- color-eyre/src/config.rs | 5 -- color-eyre/src/handler.rs | 1 - color-eyre/src/lib.rs | 22 +++++---- color-spantrace/.gitignore | 2 - color-spantrace/src/lib.rs | 3 +- eyre/Cargo.toml | 5 +- eyre/src/lib.rs | 5 +- simple-eyre/Cargo.toml | 29 +++++------- simple-eyre/src/lib.rs | 11 +++-- 11 files changed, 54 insertions(+), 141 deletions(-) delete mode 100644 color-spantrace/.gitignore diff --git a/color-eyre/.github/workflows/ci.yml b/color-eyre/.github/workflows/ci.yml index 23ad9a0..2cf9ce8 100644 --- a/color-eyre/.github/workflows/ci.yml +++ b/color-eyre/.github/workflows/ci.yml @@ -7,23 +7,6 @@ on: name: Continuous integration jobs: - check: - name: Check - runs-on: ubuntu-latest - strategy: - matrix: - rust: - - stable - 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-features: name: Test Features runs-on: ubuntu-latest @@ -78,58 +61,3 @@ jobs: - name: run wasm tests run: wasm-pack test --node if: ${{ matrix.target == 'wasm32-unknown-unknown' }} - - test-os: - name: Test Operating Systems - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [ubuntu-latest, windows-latest, macOS-latest] - steps: - - uses: actions/checkout@v1 - - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - profile: minimal - override: true - - uses: actions-rs/cargo@v1 - with: - command: test - - fmt: - name: Rustfmt - runs-on: ubuntu-latest - strategy: - matrix: - rust: - - stable - 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 - 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 diff --git a/color-eyre/Cargo.toml b/color-eyre/Cargo.toml index 9f325ec..95865ad 100644 --- a/color-eyre/Cargo.toml +++ b/color-eyre/Cargo.toml @@ -37,6 +37,10 @@ ansi-parser = "0.8.0" [target.'cfg(target_arch = "wasm32")'.dev-dependencies] wasm-bindgen-test = "0.3.15" +[[example]] +name = "color-eyre-usage" +path = "examples/usage.rs" + [package.metadata.docs.rs] all-features = true rustdoc-args = ["--cfg", "docsrs"] @@ -47,37 +51,27 @@ dev-version = false [[package.metadata.release.pre-release-replacements]] file = "CHANGELOG.md" search = "Unreleased" -replace="{{version}}" +replace = "{{version}}" [[package.metadata.release.pre-release-replacements]] -file = "src/lib.rs" -search = "#!\\[doc\\(html_root_url.*" -replace = "#![doc(html_root_url = \"https://docs.rs/{{crate_name}}/{{version}}\")]" -exactly = 1 +file = "CHANGELOG.md" +search = "ReleaseDate" +replace = "{{date}}" [[package.metadata.release.pre-release-replacements]] file = "CHANGELOG.md" -search = "\\.\\.\\.HEAD" -replace="...{{tag_name}}" +search = "" +replace = "\n\n## [Unreleased] - ReleaseDate" exactly = 1 [[package.metadata.release.pre-release-replacements]] file = "CHANGELOG.md" -search = "ReleaseDate" -replace="{{date}}" - -[[package.metadata.release.pre-release-replacements]] -file="CHANGELOG.md" -search="" -replace="\n\n## [Unreleased] - ReleaseDate" -exactly=1 +search = "\\.\\.\\.HEAD" +replace = "...{{tag_name}}" +exactly = 1 [[package.metadata.release.pre-release-replacements]] -file="CHANGELOG.md" -search="" -replace="\n[Unreleased]: https://github.com/eyre-rs/{{crate_name}}/compare/{{tag_name}}...HEAD" -exactly=1 - -[[example]] -name = "color-eyre-usage" -path = "examples/usage.rs" +file = "CHANGELOG.md" +search = "" +replace = "\n[Unreleased]: https://github.com/eyre-rs/{{crate_name}}/compare/{{tag_name}}...HEAD" +exactly = 1 diff --git a/color-eyre/src/config.rs b/color-eyre/src/config.rs index 22b4e60..3f14a6e 100644 --- a/color-eyre/src/config.rs +++ b/color-eyre/src/config.rs @@ -578,7 +578,6 @@ impl HookBuilder { /// .unwrap(); /// ``` #[cfg(feature = "issue-url")] - #[cfg_attr(docsrs, doc(cfg(feature = "issue-url")))] pub fn issue_url(mut self, url: S) -> Self { self.issue_url = Some(url.to_string()); self @@ -598,7 +597,6 @@ impl HookBuilder { /// .unwrap(); /// ``` #[cfg(feature = "issue-url")] - #[cfg_attr(docsrs, doc(cfg(feature = "issue-url")))] pub fn add_issue_metadata(mut self, key: K, value: V) -> Self where K: Display, @@ -634,7 +632,6 @@ impl HookBuilder { /// .unwrap(); /// #[cfg(feature = "issue-url")] - #[cfg_attr(docsrs, doc(cfg(feature = "issue-url")))] pub fn issue_filter(mut self, predicate: F) -> Self where F: Fn(crate::ErrorKind<'_>) -> bool + Send + Sync + 'static, @@ -661,7 +658,6 @@ impl HookBuilder { /// /// This will not disable the location section in a panic message. #[cfg(feature = "track-caller")] - #[cfg_attr(docsrs, doc(cfg(feature = "track-caller")))] pub fn display_location_section(mut self, cond: bool) -> Self { self.display_location_section = cond; self @@ -1217,5 +1213,4 @@ pub type FilterCallback = dyn Fn(&mut Vec<&Frame>) + Send + Sync + 'static; /// Callback for filtering issue url generation in error reports #[cfg(feature = "issue-url")] -#[cfg_attr(docsrs, doc(cfg(feature = "issue-url")))] pub type IssueFilterCallback = dyn Fn(crate::ErrorKind<'_>) -> bool + Send + Sync + 'static; diff --git a/color-eyre/src/handler.rs b/color-eyre/src/handler.rs index 80c1417..1f29cb3 100644 --- a/color-eyre/src/handler.rs +++ b/color-eyre/src/handler.rs @@ -24,7 +24,6 @@ impl Handler { /// Return a reference to the captured `SpanTrace` type #[cfg(feature = "capture-spantrace")] - #[cfg_attr(docsrs, doc(cfg(feature = "capture-spantrace")))] pub fn span_trace(&self) -> Option<&SpanTrace> { self.span_trace.as_ref() } diff --git a/color-eyre/src/lib.rs b/color-eyre/src/lib.rs index 2664cad..54d3529 100644 --- a/color-eyre/src/lib.rs +++ b/color-eyre/src/lib.rs @@ -325,20 +325,23 @@ //! [`eyre::EyreHandler`]: https://docs.rs/eyre/*/eyre/trait.EyreHandler.html //! [`backtrace::Backtrace`]: https://docs.rs/backtrace/*/backtrace/struct.Backtrace.html //! [`tracing_error::SpanTrace`]: https://docs.rs/tracing-error/*/tracing_error/struct.SpanTrace.html -//! [`color-spantrace`]: https://github.com/yaahc/color-spantrace +//! [`color-spantrace`]: https://docs.rs/color-spantrace //! [`Section`]: https://docs.rs/color-eyre/*/color_eyre/trait.Section.html //! [`eyre::Report`]: https://docs.rs/eyre/*/eyre/struct.Report.html //! [`eyre::Result`]: https://docs.rs/eyre/*/eyre/type.Result.html //! [`Handler`]: https://docs.rs/color-eyre/*/color_eyre/struct.Handler.html -//! [`examples/usage.rs`]: https://github.com/yaahc/color-eyre/blob/master/examples/usage.rs -//! [`examples/custom_filter.rs`]: https://github.com/yaahc/color-eyre/blob/master/examples/custom_filter.rs -//! [`examples/custom_section.rs`]: https://github.com/yaahc/color-eyre/blob/master/examples/custom_section.rs -//! [`examples/multiple_errors.rs`]: https://github.com/yaahc/color-eyre/blob/master/examples/multiple_errors.rs -#![doc(html_root_url = "https://docs.rs/color-eyre/0.6.2")] -#![cfg_attr(docsrs, feature(doc_cfg))] +//! [`examples/usage.rs`]: https://github.com/eyre-rs/eyre/blob/master/color-eyre/examples/usage.rs +//! [`examples/custom_filter.rs`]: https://github.com/eyre-rs/eyre/blob/master/color-eyre/examples/custom_filter.rs +//! [`examples/custom_section.rs`]: https://github.com/eyre-rs/eyre/blob/master/color-eyre/examples/custom_section.rs +//! [`examples/multiple_errors.rs`]: https://github.com/eyre-rs/eyre/blob/master/color-eyre/examples/multiple_errors.rs +#![cfg_attr( + nightly, + feature(rustdoc_missing_doc_code_examples), + warn(rustdoc::missing_doc_code_examples) +)] +#![cfg_attr(docsrs, feature(doc_auto_cfg))] #![warn( missing_docs, - rustdoc::missing_doc_code_examples, rust_2018_idioms, unreachable_pub, bad_style, @@ -349,13 +352,13 @@ overflowing_literals, path_statements, patterns_in_fns_without_body, + unconditional_recursion, unused, unused_allocation, unused_comparisons, unused_parens, while_true )] -#![allow(clippy::try_err)] use std::sync::Arc; @@ -418,7 +421,6 @@ pub struct Handler { /// The kind of type erased error being reported #[cfg(feature = "issue-url")] -#[cfg_attr(docsrs, doc(cfg(feature = "issue-url")))] pub enum ErrorKind<'a> { /// A non recoverable error aka `panic!` NonRecoverable(&'a dyn std::any::Any), diff --git a/color-spantrace/.gitignore b/color-spantrace/.gitignore deleted file mode 100644 index 96ef6c0..0000000 --- a/color-spantrace/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/target -Cargo.lock diff --git a/color-spantrace/src/lib.rs b/color-spantrace/src/lib.rs index 214799b..f3e8a48 100644 --- a/color-spantrace/src/lib.rs +++ b/color-spantrace/src/lib.rs @@ -59,12 +59,12 @@ //! //! [`tracing_error::SpanTrace`]: https://docs.rs/tracing-error/*/tracing_error/struct.SpanTrace.html //! [`color-backtrace`]: https://github.com/athre0z/color-backtrace -#![doc(html_root_url = "https://docs.rs/color-spantrace/0.2.1")] #![cfg_attr( nightly, feature(rustdoc_missing_doc_code_examples), warn(rustdoc::missing_doc_code_examples) )] +#![cfg_attr(docsrs, feature(doc_auto_cfg))] #![warn( missing_debug_implementations, missing_docs, @@ -85,6 +85,7 @@ unused_parens, while_true )] + use once_cell::sync::OnceCell; use owo_colors::{style, Style}; use std::env; diff --git a/eyre/Cargo.toml b/eyre/Cargo.toml index 1085cbb..5924409 100644 --- a/eyre/Cargo.toml +++ b/eyre/Cargo.toml @@ -1,11 +1,11 @@ [package] name = "eyre" version = "1.0.0" -authors = ["David Tolnay ", "Jane Lusby "] description = "Flexible concrete Error Reporting type built on std::error::Error with customizable Reports" documentation = "https://docs.rs/eyre" categories = ["rust-patterns"] +authors = { workspace = true } edition = { workspace = true } license = { workspace = true } repository = { workspace = true } @@ -35,7 +35,8 @@ pyo3 = { version = "0.20", default-features = false, features = ["auto-initializ [package.metadata.docs.rs] targets = ["x86_64-unknown-linux-gnu"] -rustdoc-args = ["--cfg", "doc_cfg"] +all-features = true +rustdoc-args = ["--cfg", "docsrs"] [package.metadata.workspaces] independent = true diff --git a/eyre/src/lib.rs b/eyre/src/lib.rs index 33c60d3..8e9f003 100644 --- a/eyre/src/lib.rs +++ b/eyre/src/lib.rs @@ -328,12 +328,13 @@ //! [`simple-eyre`]: https://github.com/eyre-rs/simple-eyre //! [`color-spantrace`]: https://github.com/eyre-rs/color-spantrace //! [`color-backtrace`]: https://github.com/athre0z/color-backtrace -#![doc(html_root_url = "https://docs.rs/eyre/0.6.11")] #![cfg_attr( nightly, feature(rustdoc_missing_doc_code_examples), warn(rustdoc::missing_doc_code_examples) )] +#![cfg_attr(backtrace, feature(backtrace))] +#![cfg_attr(docsrs, feature(doc_auto_cfg))] #![warn( missing_debug_implementations, missing_docs, @@ -355,8 +356,6 @@ unused_parens, while_true )] -#![cfg_attr(backtrace, feature(backtrace))] -#![cfg_attr(doc_cfg, feature(doc_cfg))] #![allow( clippy::needless_doctest_main, clippy::new_ret_no_self, diff --git a/simple-eyre/Cargo.toml b/simple-eyre/Cargo.toml index f6e8ddd..1c71c81 100644 --- a/simple-eyre/Cargo.toml +++ b/simple-eyre/Cargo.toml @@ -25,35 +25,28 @@ no-dev-version = true [[package.metadata.release.pre-release-replacements]] file = "CHANGELOG.md" search = "Unreleased" -replace="{{version}}" - -[[package.metadata.release.pre-release-replacements]] -file = "src/lib.rs" -search = "#!\\[doc\\(html_root_url.*" -replace = "#![doc(html_root_url = \"https://docs.rs/{{crate_name}}/{{version}}\")]" -exactly = 1 +replace = "{{version}}" [[package.metadata.release.pre-release-replacements]] file = "CHANGELOG.md" search = "ReleaseDate" -replace="{{date}}" +replace = "{{date}}" [[package.metadata.release.pre-release-replacements]] -file="CHANGELOG.md" -search="" -replace="\n\n## [Unreleased] - ReleaseDate" -exactly=1 +file = "CHANGELOG.md" +search = "" +replace = "\n\n## [Unreleased] - ReleaseDate" +exactly = 1 # Disable this replacement on the very first release [[package.metadata.release.pre-release-replacements]] file = "CHANGELOG.md" search = "\\.\\.\\.HEAD" -replace="...{{tag_name}}" +replace = "...{{tag_name}}" exactly = 1 -# END SECTION, do not comment out the replacement below this, and do not reorder them [[package.metadata.release.pre-release-replacements]] -file="CHANGELOG.md" -search="" -replace="\n[Unreleased]: https://github.com/yaahc/{{crate_name}}/compare/{{tag_name}}...HEAD" -exactly=1 +file = "CHANGELOG.md" +search = "" +replace = "\n[Unreleased]: https://github.com/eyre-rs/{{crate_name}}/compare/{{tag_name}}...HEAD" +exactly = 1 diff --git a/simple-eyre/src/lib.rs b/simple-eyre/src/lib.rs index e9c9e24..c2a5ee5 100644 --- a/simple-eyre/src/lib.rs +++ b/simple-eyre/src/lib.rs @@ -29,15 +29,18 @@ //! //! [`eyre::EyreHandler`]: https://docs.rs/eyre/*/eyre/trait.EyreHandler.html //! [`eyre`]: https://docs.rs/eyre -#![doc(html_root_url = "https://docs.rs/simple-eyre/0.3.1")] +#![cfg_attr( + nightly, + feature(rustdoc_missing_doc_code_examples), + warn(rustdoc::missing_doc_code_examples) +)] +#![cfg_attr(docsrs, feature(doc_auto_cfg))] #![warn( missing_debug_implementations, missing_docs, - missing_doc_code_examples, rust_2018_idioms, unreachable_pub, bad_style, - const_err, dead_code, improper_ctypes, non_shorthand_field_patterns, @@ -45,7 +48,6 @@ overflowing_literals, path_statements, patterns_in_fns_without_body, - private_in_public, unconditional_recursion, unused, unused_allocation, @@ -53,6 +55,7 @@ unused_parens, while_true )] + pub use eyre; #[doc(hidden)] pub use eyre::{Report, Result};