mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-23 15:23:46 +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`
26 lines
887 B
TOML
26 lines
887 B
TOML
[package]
|
|
name = "rustc_lint"
|
|
version = "0.0.0"
|
|
edition = "2018"
|
|
|
|
[dependencies]
|
|
if_chain = "1.0"
|
|
tracing = "0.1"
|
|
unicode-security = "0.0.5"
|
|
rustc_middle = { path = "../rustc_middle" }
|
|
rustc_ast_pretty = { path = "../rustc_ast_pretty" }
|
|
rustc_attr = { path = "../rustc_attr" }
|
|
rustc_errors = { path = "../rustc_errors" }
|
|
rustc_hir = { path = "../rustc_hir" }
|
|
rustc_target = { path = "../rustc_target" }
|
|
rustc_ast = { path = "../rustc_ast" }
|
|
rustc_span = { path = "../rustc_span" }
|
|
rustc_data_structures = { path = "../rustc_data_structures" }
|
|
rustc_feature = { path = "../rustc_feature" }
|
|
rustc_index = { path = "../rustc_index" }
|
|
rustc_session = { path = "../rustc_session" }
|
|
rustc_serialize = { path = "../rustc_serialize" }
|
|
rustc_trait_selection = { path = "../rustc_trait_selection" }
|
|
rustc_parse_format = { path = "../rustc_parse_format" }
|
|
rustc_infer = { path = "../rustc_infer" }
|