Skip to content
This repository has been archived by the owner on Aug 1, 2024. It is now read-only.

Ergonomics: Full re-exports from eyre; export color_eyre::eyre! macro, rather than eyre crate #145

Open
LeoniePhiline opened this issue Dec 7, 2023 · 2 comments

Comments

@LeoniePhiline
Copy link

LeoniePhiline commented Dec 7, 2023

I commonly use color_eyre and its re-exports from eyre.

However, not all commonly used symbols are re-exported. This results in nested imports like:

use color_eyre::{
    eyre::{bail, eyre, WrapErr},
    Report, Result,
};

The ambiguity between color_eyre::eyre (the crate re-export) and color_eyre::eyre::eyre (the macro) is also a pain point in my daily work.

(Rust analyzer unfortunately makes this worse by onlym despite the ! postfix, offering an auto-import of color_eyre::eyre instead of the correct color_eyre::eyre::eyre when eyre! is not in scope.)

From an ergonomics standpoint, I would wish for the full eyre feature-set (including e.g. WrapErr and OptionExt) to be re-exported from color_eyre:

use color_eyre::{bail, eyre, OptionExt, Report, Result, WrapErr};

In the above hypothetical use statement, the eyre imports the eyre! macro, not the eyre crate.

This is a breaking change.

@LeoniePhiline
Copy link
Author

Note: anyhow-compat issues discussed at eyre-rs/eyre#131 also apply to color_eyre re-exports.

@LeoniePhiline
Copy link
Author

Status: Waiting on eyre-rs/eyre#138 to be able to re-export anyhow compatibility layer.

Thus, this should also replace #142.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant