diff options
| author | bors <bors@rust-lang.org> | 2021-08-17 16:43:40 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2021-08-17 16:43:40 +0000 |
| commit | d83da1d05dc75ff3452c068299f40e5d99589d71 (patch) | |
| tree | 44e5ad22d0c3364b34816ac98a2cbfd812f49723 /compiler/rustc_mir/src/transform/coverage/mod.rs | |
| parent | 806b3995b8f622d5de10afcc11c10a028a7b876a (diff) | |
| parent | ab8cbc31905ccd010318fc572fea7bf92c46a70f (diff) | |
| download | rust-d83da1d05dc75ff3452c068299f40e5d99589d71.tar.gz rust-d83da1d05dc75ff3452c068299f40e5d99589d71.zip | |
Auto merge of #88083 - m-ou-se:non-fmt-panics-suggest-debug, r=estebank
Improve non_fmt_panics suggestion based on trait impls.
This improves the non_fmt_panics lint suggestions by checking first which trait (Display or Debug) are actually implemented on the type.
Fixes https://github.com/rust-lang/rust/issues/87313
Fixes https://github.com/rust-lang/rust/issues/87999
Before:
```
help: add a "{}" format string to Display the message
|
2 | panic!("{}", Some(1));
| +++++
help: or use std::panic::panic_any instead
|
2 | std::panic::panic_any(Some(1));
| ~~~~~~~~~~~~~~~~~~~~~
```
After:
```
help: add a "{:?}" format string to use the Debug implementation of `Option<i32>`
|
2 | panic!("{:?}", Some(1));
| +++++++
help: or use std::panic::panic_any instead
|
2 | std::panic::panic_any(Some(1));
| ~~~~~~~~~~~~~~~~~~~~~
```
r? `@estebank`
Diffstat (limited to 'compiler/rustc_mir/src/transform/coverage/mod.rs')
0 files changed, 0 insertions, 0 deletions
