Skip to content

Commit

Permalink
Add missing core::fmt::{self, Write} imports in testing post
Browse files Browse the repository at this point in the history
  • Loading branch information
phil-opp committed Apr 28, 2019
1 parent b7e98fa commit 1f97103
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions blog/content/second-edition/posts/04-testing/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 };
Expand Down

0 comments on commit 1f97103

Please sign in to comment.