Add missing core::fmt::{self, Write} imports in testing post

This commit is contained in:
Philipp Oppermann
2019-04-28 12:59:27 +02:00
parent b7e98fa04a
commit 1f9710308f

View File

@@ -923,6 +923,8 @@ Checking the reported panic message is a bit more complicated. The reason is tha
```rust
// in tests/panic_handler.rs
use core::fmt;
/// Compares a `fmt::Arguments` instance with the `MESSAGE` string.
///
/// To use this type, write the `fmt::Arguments` instance to it using the
@@ -956,6 +958,8 @@ With the `CompareMessage` type, we can finally implement our `check_message` fun
#![feature(panic_info_message)] // at the top of the file
use core::fmt::Write;
fn check_message(info: &PanicInfo) {
let message = info.message().unwrap_or_else(|| fail("no message"));
let mut compare_message = CompareMessage { equals: false };