From 238223af99dcd4ff41ad86e6ba7a0d2acb2d5ab5 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Wed, 16 Aug 2023 17:14:33 -0700 Subject: [PATCH] Work around ridiculous rust-analyzer behavior As far as I can tell there is still no way to keep it from autoimporting the private macros and enum variants here: anyhow::__private::format, anyhow::__private::Err. --- src/kind.rs | 3 +++ src/lib.rs | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/src/kind.rs b/src/kind.rs index f47fe44..21d76aa 100644 --- a/src/kind.rs +++ b/src/kind.rs @@ -52,6 +52,7 @@ use crate::StdError; pub struct Adhoc; +#[doc(hidden)] pub trait AdhocKind: Sized { #[inline] fn anyhow_kind(&self) -> Adhoc { @@ -73,6 +74,7 @@ impl Adhoc { pub struct Trait; +#[doc(hidden)] pub trait TraitKind: Sized { #[inline] fn anyhow_kind(&self) -> Trait { @@ -96,6 +98,7 @@ impl Trait { pub struct Boxed; #[cfg(feature = "std")] +#[doc(hidden)] pub trait BoxedKind: Sized { #[inline] fn anyhow_kind(&self) -> Boxed { diff --git a/src/lib.rs b/src/lib.rs index dd3f51e..445fdf0 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -642,16 +642,22 @@ pub mod __private { use alloc::fmt; use core::fmt::Arguments; + #[doc(hidden)] pub use crate::ensure::{BothDebug, NotBothDebug}; + #[doc(hidden)] pub use alloc::format; + #[doc(hidden)] pub use core::result::Result::Err; + #[doc(hidden)] pub use core::{concat, format_args, stringify}; #[doc(hidden)] pub mod kind { + #[doc(hidden)] pub use crate::kind::{AdhocKind, TraitKind}; #[cfg(feature = "std")] + #[doc(hidden)] pub use crate::kind::BoxedKind; }