Skip to content

Commit 7b96160

Browse files
committed
PR feedback
1 parent 397d1a6 commit 7b96160

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/rust-2021/panic-macro-consistency.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,12 @@ running:
7171
cargo fix --edition
7272
```
7373

74-
Should you choose to or need to manually migrate, you'll need to update all panic invocations to either use the same
75-
formatting as `println` currently does or use
74+
Should you choose or need to manually migrate, you'll need to update all panic invocations to either use the same
75+
formatting as `println` or use `std::panic::panic_any` to panic with non-string data.
7676

77-
For example, in the case of `panic!(MyStruct)`, you'll need to either convert to using `std::panic::panic_any` (note
78-
that this is a function not a macro).
77+
For example, in the case of `panic!(MyStruct)`, you'll need to convert to using `std::panic::panic_any` (note
78+
that this is a function not a macro): `std::panic::panic_any(MyStruct)`.
7979

80-
In the case of panic messages that include curly braces but no arguments (e.g., `panic!("Some curlies: {}")), you'll
81-
need to print the literal string by either using the same syntax as `println!` (i.e., `panic!("{}", Some curlies: {}")`)
82-
or by escaping them (i.e., `panic!("Some curlies: {{}}")`).
80+
In the case of panic messages that include curly braces but the wrong number of arguments (e.g., `panic!("Some curlies: {}")`),
81+
you can panic with the string literal by either using the same syntax as `println!` (i.e., `panic!("{}", "Some curlies: {}")`)
82+
or by escaping the curly braces (i.e., `panic!("Some curlies: {{}}")`).

0 commit comments

Comments
 (0)