From 80c362b92bda7776fc88e31c479455890b4a3688 Mon Sep 17 00:00:00 2001 From: Jane Lusby Date: Thu, 14 Apr 2022 13:22:24 -0700 Subject: [PATCH] add should_panic annotations --- library/core/src/result.rs | 6 +++--- 1 file 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 @@ pub fn iter_mut(&mut self) -> IterMut<'_, T> { /// 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 @@ pub fn iter_mut(&mut self) -> IterMut<'_, T> { /// 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 @@ pub fn iter_mut(&mut self) -> IterMut<'_, T> { /// 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`"); /// ``` -- 2.44.0