Skip to content

Commit 80c362b

Browse files
committed
add should_panic annotations
1 parent 3d951b3 commit 80c362b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

library/core/src/result.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1034,23 +1034,23 @@ impl<T, E> Result<T, E> {
10341034
/// In the former case the expect message is used to describe the error that has occurred which
10351035
/// is considered a bug. Consider the following example:
10361036
///
1037-
/// ```
1037+
/// ```should_panic
10381038
/// // Read environment variable, panic if it is not present
10391039
/// let path = std::env::var("IMPORTANT_PATH").unwrap();
10401040
/// ```
10411041
///
10421042
/// In the "expect as error message" style we would use expect to describe that the environment
10431043
/// variable was not set when it should have been:
10441044
///
1045-
/// ```
1045+
/// ```should_panic
10461046
/// let path = std::env::var("IMPORTANT_PATH")
10471047
/// .expect("env variable `IMPORTANT_PATH` is not set");
10481048
/// ```
10491049
///
10501050
/// In the latter style, we would instead describe the reason we _expect_ the `Result` will
10511051
/// always be `Ok`. With this style we would instead write:
10521052
///
1053-
/// ```
1053+
/// ```should_panic
10541054
/// let path = std::env::var("IMPORTANT_PATH")
10551055
/// .expect("env variable `IMPORTANT_PATH` is always be set by `wrapper_script.sh`");
10561056
/// ```

0 commit comments

Comments
 (0)