about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJane Lusby <jlusby@yaah.dev>2022-04-14 13:22:24 -0700
committerJane Lusby <jlusby@yaah.dev>2022-04-14 13:22:24 -0700
commit80c362b92bda7776fc88e31c479455890b4a3688 (patch)
tree8887e490f3d6dcf35b972c33a05605602664f578
parent3d951b3d214f5d913153e2e695d7e6ba907bba62 (diff)
downloadrust-80c362b92bda7776fc88e31c479455890b4a3688.tar.gz
rust-80c362b92bda7776fc88e31c479455890b4a3688.zip
add should_panic annotations
-rw-r--r--library/core/src/result.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/library/core/src/result.rs b/library/core/src/result.rs
index 6189000cd36..8a68e3fe6d6 100644
--- a/library/core/src/result.rs
+++ b/library/core/src/result.rs
@@ -1034,7 +1034,7 @@ impl<T, E> Result<T, E> {
     /// In the former case the expect message is used to describe the error that has occurred which
     /// is considered a bug. Consider the following example:
     ///
-    /// ```
+    /// ```should_panic
     /// // Read environment variable, panic if it is not present
     /// let path = std::env::var("IMPORTANT_PATH").unwrap();
     /// ```
@@ -1042,7 +1042,7 @@ impl<T, E> Result<T, E> {
     /// In the "expect as error message" style we would use expect to describe that the environment
     /// variable was not set when it should have been:
     ///
-    /// ```
+    /// ```should_panic
     /// let path = std::env::var("IMPORTANT_PATH")
     ///     .expect("env variable `IMPORTANT_PATH` is not set");
     /// ```
@@ -1050,7 +1050,7 @@ impl<T, E> Result<T, E> {
     /// In the latter style, we would instead describe the reason we _expect_ the `Result` will
     /// always be `Ok`. With this style we would instead write:
     ///
-    /// ```
+    /// ```should_panic
     /// let path = std::env::var("IMPORTANT_PATH")
     ///     .expect("env variable `IMPORTANT_PATH` is always be set by `wrapper_script.sh`");
     /// ```