From d7c7f5c82acfa9c01ed6dd3a392d9cfee47d86d7 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Mon, 15 Jul 2024 18:14:28 +0100 Subject: [PATCH 1/3] Remove the doc(hidden) attribute on TestError Signed-off-by: Ian Jackson --- src/lib.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index ae595f7..3e4f4bb 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -11,7 +11,6 @@ /// /// This type is useful only in unit tests and cannot be directly instantiated. #[derive(Debug)] -#[doc(hidden)] pub enum TestError {} impl From for TestError { From 90d52cca9b50d7c2a66eafec37fba1bc32d356d1 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Mon, 15 Jul 2024 18:16:38 +0100 Subject: [PATCH 2/3] Clarify docs for TestError a little Signed-off-by: Ian Jackson --- src/lib.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 3e4f4bb..bd11ff9 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -4,12 +4,15 @@ // the docs illustrate the usage in test functions #![allow(clippy::test_attr_in_doctest)] -/// Error with a stacktrace +/// Error, but one which immediately panics with a stacktrace +/// +/// Usually used via [`TestResult`]. /// /// Any other type of error can be converted to this one but the /// conversion will always panic. /// -/// This type is useful only in unit tests and cannot be directly instantiated. +/// This type is useful only in unit tests. +/// It cannot be instantiated: no values of this type can ever exist. #[derive(Debug)] pub enum TestError {} From 7ef38fd23461a560b56469112e1b7809d6a81a26 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Mon, 15 Jul 2024 18:19:56 +0100 Subject: [PATCH 3/3] Improve description of TestResult slightly Signed-off-by: Ian Jackson --- src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index bd11ff9..eb6ab2d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -25,7 +25,7 @@ impl From for TestError { } } -/// Unit test result +/// Unit test result - always panics when an error occurs /// /// This type allows panicking when encountering any type of /// failure. Thus it allows using the `?` operator in unit tests but still