Skip to content

Commit

Permalink
Hide the Error type from the Documentation
Browse files Browse the repository at this point in the history
In order to not commit to having a publicly visible copy of the Error
trait in snafu, hiding it from the documentation allows for snafu to
still support all of its features, but the user never gets to use the
trait. This way snafu can switch out the trait at any point with
`core::error::Error` if that becomes a thing. Alternatively the trait
here can also be made visible at some point. Both of these possibilities
are not breaking, so the conservative approach with doc(hidden) allows
for the smoothest experience going forward.
  • Loading branch information
CryZe committed Sep 25, 2019
1 parent 253df2f commit 4d61922
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ all-features = true
[features]
default = ["backtraces", "std"]

# Uses the `std::error::Error` trait instead of its own
# Implement the `std::error::Error` trait.
std = []

# Adds the backtrace type
Expand Down
2 changes: 2 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,11 +132,13 @@ generate_guide! {
doc_comment::doctest!("../README.md", readme_tests);

#[cfg(any(feature = "std", test))]
#[doc(hidden)]
pub use std::error::Error;

#[cfg(not(any(feature = "std", test)))]
mod no_std_error;
#[cfg(not(any(feature = "std", test)))]
#[doc(hidden)]
pub use no_std_error::Error;

/// Ensure a condition is true. If it is not, return from the function
Expand Down

0 comments on commit 4d61922

Please sign in to comment.