Rollup merge of #104383 - WaffleLapkin:rustc_undiagnostic_item, r=compiler-errors
Remove unused symbols and diagnostic items As the title suggests, this removes unused symbols from `sym::` and `#[rustc_diagnostic_item]` annotations that weren't mentioned anywhere. Originally I tried to use grep, to find symbols and item names that are never mentioned via `sym::name`, however this produced a lot of false positives (?), for example clippy matching on `Symbol::as_str` or macros "implicitly" adding `sym::`. I ended up fixing all these false positives (?) by hand, but tbh I'm not sure if it was worth it...
This commit is contained in:
commit
2c29b05fb2
7 changed files with 7 additions and 79 deletions
|
|
@ -199,12 +199,12 @@ pub fn first_node_in_macro(cx: &LateContext<'_>, node: &impl HirNode) -> Option<
|
|||
pub fn is_panic(cx: &LateContext<'_>, def_id: DefId) -> bool {
|
||||
let Some(name) = cx.tcx.get_diagnostic_name(def_id) else { return false };
|
||||
matches!(
|
||||
name.as_str(),
|
||||
"core_panic_macro"
|
||||
| "std_panic_macro"
|
||||
| "core_panic_2015_macro"
|
||||
| "std_panic_2015_macro"
|
||||
| "core_panic_2021_macro"
|
||||
name,
|
||||
sym::core_panic_macro
|
||||
| sym::std_panic_macro
|
||||
| sym::core_panic_2015_macro
|
||||
| sym::std_panic_2015_macro
|
||||
| sym::core_panic_2021_macro
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue