mirror of
https://github.com/rust-lang/rust.git
synced 2025-01-20 19:52:48 +00:00
d83da1d05d
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` |
||
---|---|---|
.. | ||
src | ||
Cargo.toml |