Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add simple-eyre to workspace #165

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
members = [
"color-eyre",
"color-spantrace",
"eyre"
"eyre",
"simple-eyre",
]

[workspace.package]
Expand All @@ -21,4 +22,3 @@ owo-colors = "3.2.0"
[profile.dev.package.backtrace]
opt-level = 3


72 changes: 0 additions & 72 deletions color-eyre/.github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
40 changes: 17 additions & 23 deletions color-eyre/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand All @@ -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 = "<!-- next-header -->"
replace = "<!-- next-header -->\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="<!-- next-header -->"
replace="<!-- next-header -->\n\n## [Unreleased] - ReleaseDate"
exactly=1
search = "\\.\\.\\.HEAD"
replace = "...{{tag_name}}"
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"
file = "CHANGELOG.md"
search = "<!-- next-url -->"
replace = "<!-- next-url -->\n[Unreleased]: https://github.com/eyre-rs/{{crate_name}}/compare/{{tag_name}}...HEAD"
exactly = 1
5 changes: 0 additions & 5 deletions color-eyre/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
use std::{fmt, path::PathBuf, sync::Arc};

#[derive(Debug)]
struct InstallError;

Check warning on line 15 in color-eyre/src/config.rs

View workflow job for this annotation

GitHub Actions / Miri

struct `InstallError` is never constructed

Check warning on line 15 in color-eyre/src/config.rs

View workflow job for this annotation

GitHub Actions / Miri

struct `InstallError` is never constructed

Check warning on line 15 in color-eyre/src/config.rs

View workflow job for this annotation

GitHub Actions / Test Suite (beta)

struct `InstallError` is never constructed

Check warning on line 15 in color-eyre/src/config.rs

View workflow job for this annotation

GitHub Actions / Test Suite (beta, --no-default-features --features track-caller)

struct `InstallError` is never constructed

Check warning on line 15 in color-eyre/src/config.rs

View workflow job for this annotation

GitHub Actions / Test Suite (beta, --all-features)

struct `InstallError` is never constructed

Check warning on line 15 in color-eyre/src/config.rs

View workflow job for this annotation

GitHub Actions / Test Suite (beta, --features pyo3)

struct `InstallError` is never constructed

Check warning on line 15 in color-eyre/src/config.rs

View workflow job for this annotation

GitHub Actions / Test Suite (beta, --no-default-features --features auto-install)

struct `InstallError` is never constructed

Check warning on line 15 in color-eyre/src/config.rs

View workflow job for this annotation

GitHub Actions / Test Suite (beta, --no-default-features)

struct `InstallError` is never constructed

Check warning on line 15 in color-eyre/src/config.rs

View workflow job for this annotation

GitHub Actions / Test Suite (nightly)

struct `InstallError` is never constructed

Check warning on line 15 in color-eyre/src/config.rs

View workflow job for this annotation

GitHub Actions / Test Suite (nightly, --no-default-features --features track-caller)

struct `InstallError` is never constructed

Check warning on line 15 in color-eyre/src/config.rs

View workflow job for this annotation

GitHub Actions / Test Suite (nightly, --features pyo3)

struct `InstallError` is never constructed

Check warning on line 15 in color-eyre/src/config.rs

View workflow job for this annotation

GitHub Actions / Test Suite (nightly, --no-default-features --features auto-install)

struct `InstallError` is never constructed

Check warning on line 15 in color-eyre/src/config.rs

View workflow job for this annotation

GitHub Actions / Test Suite (nightly, --no-default-features)

struct `InstallError` is never constructed

Check warning on line 15 in color-eyre/src/config.rs

View workflow job for this annotation

GitHub Actions / Test Suite (nightly, --all-features)

struct `InstallError` is never constructed

impl fmt::Display for InstallError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
Expand All @@ -23,7 +23,7 @@
impl std::error::Error for InstallError {}

#[derive(Debug)]
struct InstallThemeError;

Check warning on line 26 in color-eyre/src/config.rs

View workflow job for this annotation

GitHub Actions / Miri

struct `InstallThemeError` is never constructed

Check warning on line 26 in color-eyre/src/config.rs

View workflow job for this annotation

GitHub Actions / Test Suite (beta)

struct `InstallThemeError` is never constructed

Check warning on line 26 in color-eyre/src/config.rs

View workflow job for this annotation

GitHub Actions / Test Suite (beta, --no-default-features --features track-caller)

struct `InstallThemeError` is never constructed

Check warning on line 26 in color-eyre/src/config.rs

View workflow job for this annotation

GitHub Actions / Test Suite (beta, --all-features)

struct `InstallThemeError` is never constructed

Check warning on line 26 in color-eyre/src/config.rs

View workflow job for this annotation

GitHub Actions / Test Suite (beta, --features pyo3)

struct `InstallThemeError` is never constructed

Check warning on line 26 in color-eyre/src/config.rs

View workflow job for this annotation

GitHub Actions / Test Suite (beta, --no-default-features --features auto-install)

struct `InstallThemeError` is never constructed

Check warning on line 26 in color-eyre/src/config.rs

View workflow job for this annotation

GitHub Actions / Test Suite (beta, --no-default-features)

struct `InstallThemeError` is never constructed

Check warning on line 26 in color-eyre/src/config.rs

View workflow job for this annotation

GitHub Actions / Test Suite (nightly)

struct `InstallThemeError` is never constructed

Check warning on line 26 in color-eyre/src/config.rs

View workflow job for this annotation

GitHub Actions / Test Suite (nightly, --no-default-features --features track-caller)

struct `InstallThemeError` is never constructed

Check warning on line 26 in color-eyre/src/config.rs

View workflow job for this annotation

GitHub Actions / Test Suite (nightly, --features pyo3)

struct `InstallThemeError` is never constructed

Check warning on line 26 in color-eyre/src/config.rs

View workflow job for this annotation

GitHub Actions / Test Suite (nightly, --no-default-features --features auto-install)

struct `InstallThemeError` is never constructed

Check warning on line 26 in color-eyre/src/config.rs

View workflow job for this annotation

GitHub Actions / Test Suite (nightly, --no-default-features)

struct `InstallThemeError` is never constructed

Check warning on line 26 in color-eyre/src/config.rs

View workflow job for this annotation

GitHub Actions / Test Suite (nightly, --all-features)

struct `InstallThemeError` is never constructed

impl fmt::Display for InstallThemeError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
Expand All @@ -34,7 +34,7 @@
impl std::error::Error for InstallThemeError {}

#[derive(Debug)]
struct InstallColorSpantraceThemeError;

Check warning on line 37 in color-eyre/src/config.rs

View workflow job for this annotation

GitHub Actions / Miri

struct `InstallColorSpantraceThemeError` is never constructed

Check warning on line 37 in color-eyre/src/config.rs

View workflow job for this annotation

GitHub Actions / Test Suite (beta)

struct `InstallColorSpantraceThemeError` is never constructed

Check warning on line 37 in color-eyre/src/config.rs

View workflow job for this annotation

GitHub Actions / Test Suite (beta, --no-default-features --features track-caller)

struct `InstallColorSpantraceThemeError` is never constructed

Check warning on line 37 in color-eyre/src/config.rs

View workflow job for this annotation

GitHub Actions / Test Suite (beta, --all-features)

struct `InstallColorSpantraceThemeError` is never constructed

Check warning on line 37 in color-eyre/src/config.rs

View workflow job for this annotation

GitHub Actions / Test Suite (beta, --features pyo3)

struct `InstallColorSpantraceThemeError` is never constructed

Check warning on line 37 in color-eyre/src/config.rs

View workflow job for this annotation

GitHub Actions / Test Suite (beta, --no-default-features --features auto-install)

struct `InstallColorSpantraceThemeError` is never constructed

Check warning on line 37 in color-eyre/src/config.rs

View workflow job for this annotation

GitHub Actions / Test Suite (beta, --no-default-features)

struct `InstallColorSpantraceThemeError` is never constructed

Check warning on line 37 in color-eyre/src/config.rs

View workflow job for this annotation

GitHub Actions / Test Suite (nightly)

struct `InstallColorSpantraceThemeError` is never constructed

Check warning on line 37 in color-eyre/src/config.rs

View workflow job for this annotation

GitHub Actions / Test Suite (nightly, --no-default-features --features track-caller)

struct `InstallColorSpantraceThemeError` is never constructed

Check warning on line 37 in color-eyre/src/config.rs

View workflow job for this annotation

GitHub Actions / Test Suite (nightly, --features pyo3)

struct `InstallColorSpantraceThemeError` is never constructed

Check warning on line 37 in color-eyre/src/config.rs

View workflow job for this annotation

GitHub Actions / Test Suite (nightly, --no-default-features --features auto-install)

struct `InstallColorSpantraceThemeError` is never constructed

Check warning on line 37 in color-eyre/src/config.rs

View workflow job for this annotation

GitHub Actions / Test Suite (nightly, --no-default-features)

struct `InstallColorSpantraceThemeError` is never constructed

Check warning on line 37 in color-eyre/src/config.rs

View workflow job for this annotation

GitHub Actions / Test Suite (nightly, --all-features)

struct `InstallColorSpantraceThemeError` is never constructed

impl fmt::Display for InstallColorSpantraceThemeError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
Expand Down Expand Up @@ -578,7 +578,6 @@
/// .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
Expand All @@ -598,7 +597,6 @@
/// .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,
Expand Down Expand Up @@ -634,7 +632,6 @@
/// .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,
Expand All @@ -661,7 +658,6 @@
///
/// 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
Expand Down Expand Up @@ -1217,5 +1213,4 @@

/// 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;
1 change: 0 additions & 1 deletion color-eyre/src/handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
Expand Down
22 changes: 12 additions & 10 deletions color-eyre/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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;

Expand Down Expand Up @@ -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),
Expand Down
2 changes: 0 additions & 2 deletions color-spantrace/.gitignore

This file was deleted.

3 changes: 2 additions & 1 deletion color-spantrace/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -85,6 +85,7 @@
unused_parens,
while_true
)]

use once_cell::sync::OnceCell;
use owo_colors::{style, Style};
use std::env;
Expand Down
5 changes: 3 additions & 2 deletions eyre/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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 }
Expand Down Expand Up @@ -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
Expand Down
5 changes: 2 additions & 3 deletions eyre/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down
18 changes: 18 additions & 0 deletions simple-eyre/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# 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).

<!-- next-header -->

## [Unreleased] - ReleaseDate

## [0.3.1] - 2021-06-24
# Fixed
- Fixed lifetime inference error caused by recent `std` change.


<!-- next-url -->
[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
Loading
Loading