mirror of
https://github.com/eyre-rs/eyre.git
synced 2025-09-28 05:21:34 +00:00
Make boilerplate for all crates consistent
This commit is contained in:
parent
cb81bc44be
commit
8d9dffabcc
72
color-eyre/.github/workflows/ci.yml
vendored
72
color-eyre/.github/workflows/ci.yml
vendored
@ -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
|
||||
|
@ -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}}\")]"
|
||||
file = "CHANGELOG.md"
|
||||
search = "ReleaseDate"
|
||||
replace = "{{date}}"
|
||||
|
||||
[[package.metadata.release.pre-release-replacements]]
|
||||
file = "CHANGELOG.md"
|
||||
search = "<!-- next-header -->"
|
||||
replace = "<!-- next-header -->\n\n## [Unreleased] - ReleaseDate"
|
||||
exactly = 1
|
||||
|
||||
[[package.metadata.release.pre-release-replacements]]
|
||||
file = "CHANGELOG.md"
|
||||
search = "\\.\\.\\.HEAD"
|
||||
replace="...{{tag_name}}"
|
||||
replace = "...{{tag_name}}"
|
||||
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="<!-- next-header -->"
|
||||
replace="<!-- next-header -->\n\n## [Unreleased] - ReleaseDate"
|
||||
exactly=1
|
||||
|
||||
[[package.metadata.release.pre-release-replacements]]
|
||||
file="CHANGELOG.md"
|
||||
search="<!-- next-url -->"
|
||||
replace="<!-- next-url -->\n[Unreleased]: https://github.com/eyre-rs/{{crate_name}}/compare/{{tag_name}}...HEAD"
|
||||
exactly=1
|
||||
|
||||
[[example]]
|
||||
name = "color-eyre-usage"
|
||||
path = "examples/usage.rs"
|
||||
search = "<!-- next-url -->"
|
||||
replace = "<!-- next-url -->\n[Unreleased]: https://github.com/eyre-rs/{{crate_name}}/compare/{{tag_name}}...HEAD"
|
||||
exactly = 1
|
||||
|
@ -578,7 +578,6 @@ impl HookBuilder {
|
||||
/// .unwrap();
|
||||
/// ```
|
||||
#[cfg(feature = "issue-url")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "issue-url")))]
|
||||
pub fn issue_url<S: ToString>(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<K, V>(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<F>(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;
|
||||
|
@ -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()
|
||||
}
|
||||
|
@ -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),
|
||||
|
2
color-spantrace/.gitignore
vendored
2
color-spantrace/.gitignore
vendored
@ -1,2 +0,0 @@
|
||||
/target
|
||||
Cargo.lock
|
@ -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;
|
||||
|
@ -1,11 +1,11 @@
|
||||
[package]
|
||||
name = "eyre"
|
||||
version = "1.0.0"
|
||||
authors = ["David Tolnay <dtolnay@gmail.com>", "Jane Lusby <jlusby42@gmail.com>"]
|
||||
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
|
||||
|
@ -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,
|
||||
|
@ -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="<!-- next-header -->"
|
||||
replace="<!-- next-header -->\n\n## [Unreleased] - ReleaseDate"
|
||||
exactly=1
|
||||
file = "CHANGELOG.md"
|
||||
search = "<!-- next-header -->"
|
||||
replace = "<!-- next-header -->\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="<!-- next-url -->"
|
||||
replace="<!-- next-url -->\n[Unreleased]: https://github.com/yaahc/{{crate_name}}/compare/{{tag_name}}...HEAD"
|
||||
exactly=1
|
||||
file = "CHANGELOG.md"
|
||||
search = "<!-- next-url -->"
|
||||
replace = "<!-- next-url -->\n[Unreleased]: https://github.com/eyre-rs/{{crate_name}}/compare/{{tag_name}}...HEAD"
|
||||
exactly = 1
|
||||
|
@ -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};
|
||||
|
Loading…
x
Reference in New Issue
Block a user