Skip to content

Commit f134d32

Browse files
Update std doctests
1 parent fc69714 commit f134d32

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

library/std/src/error.rs

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ use crate::fmt::{self, Write};
123123
/// the `Debug` output means `Report` is an ideal starting place for formatting errors returned
124124
/// from `main`.
125125
///
126-
/// ```should_panic
126+
/// ```
127127
/// #![feature(error_reporter)]
128128
/// use std::error::Report;
129129
/// # use std::error::Error;
@@ -154,9 +154,8 @@ use crate::fmt::{self, Write};
154154
/// # Err(SuperError { source: SuperErrorSideKick })
155155
/// # }
156156
///
157-
/// fn main() -> Result<(), Report<SuperError>> {
158-
/// get_super_error()?;
159-
/// Ok(())
157+
/// fn main() {
158+
/// assert!(get_super_error().is_err());
160159
/// }
161160
/// ```
162161
///
@@ -170,7 +169,7 @@ use crate::fmt::{self, Write};
170169
/// output format. If you want to make sure your `Report`s are pretty printed and include backtrace
171170
/// you will need to manually convert and enable those flags.
172171
///
173-
/// ```should_panic
172+
/// ```
174173
/// #![feature(error_reporter)]
175174
/// use std::error::Report;
176175
/// # use std::error::Error;
@@ -201,11 +200,11 @@ use crate::fmt::{self, Write};
201200
/// # Err(SuperError { source: SuperErrorSideKick })
202201
/// # }
203202
///
204-
/// fn main() -> Result<(), Report<SuperError>> {
205-
/// get_super_error()
203+
/// fn main() {
204+
/// let ret = get_super_error()
206205
/// .map_err(Report::from)
207-
/// .map_err(|r| r.pretty(true).show_backtrace(true))?;
208-
/// Ok(())
206+
/// .map_err(|r| r.pretty(true).show_backtrace(true));
207+
/// assert!(ret.is_err());
209208
/// }
210209
/// ```
211210
///

0 commit comments

Comments
 (0)