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:
Matthias Krüger 2022-11-15 01:40:44 +01:00 committed by GitHub
commit 2c29b05fb2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 7 additions and 79 deletions

View File

@ -170,8 +170,6 @@ symbols! {
Count, Count,
Cow, Cow,
Debug, Debug,
DebugStruct,
DebugTuple,
Decodable, Decodable,
Decoder, Decoder,
DecorateLint, DecorateLint,
@ -190,9 +188,6 @@ symbols! {
Error, Error,
File, File,
FileType, FileType,
Fn,
FnMut,
FnOnce,
FormatSpec, FormatSpec,
Formatter, Formatter,
From, From,
@ -211,7 +206,6 @@ symbols! {
Input, Input,
Into, Into,
IntoDiagnostic, IntoDiagnostic,
IntoFuture,
IntoIterator, IntoIterator,
IoRead, IoRead,
IoWrite, IoWrite,
@ -256,7 +250,6 @@ symbols! {
Pointer, Pointer,
Poll, Poll,
ProcMacro, ProcMacro,
ProcMacroHack,
ProceduralMasqueradeDummyType, ProceduralMasqueradeDummyType,
Range, Range,
RangeFrom, RangeFrom,
@ -332,7 +325,6 @@ symbols! {
abi_vectorcall, abi_vectorcall,
abi_x86_interrupt, abi_x86_interrupt,
abort, abort,
aborts,
add, add,
add_assign, add_assign,
add_with_overflow, add_with_overflow,
@ -344,7 +336,6 @@ symbols! {
align, align,
align_offset, align_offset,
alignment, alignment,
alignstack,
all, all,
alloc, alloc,
alloc_error_handler, alloc_error_handler,
@ -433,7 +424,6 @@ symbols! {
bool, bool,
borrowck_graphviz_format, borrowck_graphviz_format,
borrowck_graphviz_postflow, borrowck_graphviz_postflow,
borrowck_graphviz_preflow,
box_free, box_free,
box_patterns, box_patterns,
box_syntax, box_syntax,
@ -462,7 +452,6 @@ symbols! {
cfg_doctest, cfg_doctest,
cfg_eval, cfg_eval,
cfg_hide, cfg_hide,
cfg_macro,
cfg_panic, cfg_panic,
cfg_sanitize, cfg_sanitize,
cfg_target_abi, cfg_target_abi,
@ -470,7 +459,6 @@ symbols! {
cfg_target_feature, cfg_target_feature,
cfg_target_has_atomic, cfg_target_has_atomic,
cfg_target_has_atomic_equal_alignment, cfg_target_has_atomic_equal_alignment,
cfg_target_has_atomic_load_store,
cfg_target_thread_local, cfg_target_thread_local,
cfg_target_vendor, cfg_target_vendor,
cfg_version, cfg_version,
@ -495,19 +483,15 @@ symbols! {
cold, cold,
collapse_debuginfo, collapse_debuginfo,
column, column,
column_macro,
compare_and_swap,
compare_exchange, compare_exchange,
compare_exchange_weak, compare_exchange_weak,
compile_error, compile_error,
compile_error_macro,
compiler, compiler,
compiler_builtins, compiler_builtins,
compiler_fence, compiler_fence,
concat, concat,
concat_bytes, concat_bytes,
concat_idents, concat_idents,
concat_macro,
conservative_impl_trait, conservative_impl_trait,
console, console,
const_allocate, const_allocate,
@ -528,7 +512,6 @@ symbols! {
const_fn_unsize, const_fn_unsize,
const_for, const_for,
const_format_args, const_format_args,
const_generic_defaults,
const_generics, const_generics,
const_generics_defaults, const_generics_defaults,
const_if_match, const_if_match,
@ -547,22 +530,19 @@ symbols! {
const_trait, const_trait,
const_trait_bound_opt_out, const_trait_bound_opt_out,
const_trait_impl, const_trait_impl,
const_transmute,
const_try, const_try,
constant, constant,
constructor, constructor,
contents,
context, context,
convert,
copy, copy,
copy_closures, copy_closures,
copy_nonoverlapping, copy_nonoverlapping,
copysignf32, copysignf32,
copysignf64, copysignf64,
core, core,
core_intrinsics,
core_panic, core_panic,
core_panic_2015_macro, core_panic_2015_macro,
core_panic_2021_macro,
core_panic_macro, core_panic_macro,
cosf32, cosf32,
cosf64, cosf64,
@ -598,7 +578,6 @@ symbols! {
debug_assertions, debug_assertions,
debug_struct, debug_struct,
debug_struct_fields_finish, debug_struct_fields_finish,
debug_trait_builder,
debug_tuple, debug_tuple,
debug_tuple_fields_finish, debug_tuple_fields_finish,
debugger_visualizer, debugger_visualizer,
@ -630,7 +609,6 @@ symbols! {
discriminant_type, discriminant_type,
discriminant_value, discriminant_value,
dispatch_from_dyn, dispatch_from_dyn,
display_trait,
div, div,
div_assign, div_assign,
doc, doc,
@ -661,7 +639,6 @@ symbols! {
dyn_star, dyn_star,
dyn_trait, dyn_trait,
e, e,
edition_macro_pats,
edition_panic, edition_panic,
eh_catch_typeinfo, eh_catch_typeinfo,
eh_personality, eh_personality,
@ -674,7 +651,6 @@ symbols! {
encode, encode,
end, end,
env, env,
env_macro,
eprint_macro, eprint_macro,
eprintln_macro, eprintln_macro,
eq, eq,
@ -724,9 +700,7 @@ symbols! {
field, field,
field_init_shorthand, field_init_shorthand,
file, file,
file_macro,
fill, fill,
finish,
flags, flags,
float, float,
float_to_int_unchecked, float_to_int_unchecked,
@ -735,8 +709,6 @@ symbols! {
fmaf32, fmaf32,
fmaf64, fmaf64,
fmt, fmt,
fmt_as_str,
fmt_internals,
fmul_fast, fmul_fast,
fn_align, fn_align,
fn_must_use, fn_must_use,
@ -751,7 +723,6 @@ symbols! {
format_args_macro, format_args_macro,
format_args_nl, format_args_nl,
format_macro, format_macro,
fp,
freeze, freeze,
freg, freg,
frem_fast, frem_fast,
@ -814,7 +785,6 @@ symbols! {
ignore, ignore,
impl_header_lifetime_elision, impl_header_lifetime_elision,
impl_lint_pass, impl_lint_pass,
impl_macros,
impl_trait_in_bindings, impl_trait_in_bindings,
impl_trait_in_fn_trait_return, impl_trait_in_fn_trait_return,
implied_by, implied_by,
@ -826,7 +796,6 @@ symbols! {
include, include,
include_bytes, include_bytes,
include_bytes_macro, include_bytes_macro,
include_macro,
include_str, include_str,
include_str_macro, include_str_macro,
inclusive_range_syntax, inclusive_range_syntax,
@ -844,7 +813,6 @@ symbols! {
instruction_set, instruction_set,
integer_: "integer", integer_: "integer",
integral, integral,
intel,
into_future, into_future,
into_iter, into_iter,
intra_doc_pointers, intra_doc_pointers,
@ -881,7 +849,6 @@ symbols! {
lifetimes, lifetimes,
likely, likely,
line, line,
line_macro,
link, link,
link_args, link_args,
link_cfg, link_cfg,
@ -926,7 +893,6 @@ symbols! {
masked, masked,
match_beginning_vert, match_beginning_vert,
match_default_bindings, match_default_bindings,
matches_macro,
maxnumf32, maxnumf32,
maxnumf64, maxnumf64,
may_dangle, may_dangle,
@ -965,7 +931,6 @@ symbols! {
modifiers, modifiers,
module, module,
module_path, module_path,
module_path_macro,
more_qualified_paths, more_qualified_paths,
more_struct_aliases, more_struct_aliases,
movbe_target_feature, movbe_target_feature,
@ -1059,7 +1024,6 @@ symbols! {
optin_builtin_traits, optin_builtin_traits,
option, option,
option_env, option_env,
option_env_macro,
options, options,
or, or,
or_patterns, or_patterns,
@ -1102,7 +1066,6 @@ symbols! {
plugins, plugins,
pointee_trait, pointee_trait,
pointer, pointer,
pointer_trait_fmt,
poll, poll,
position, position,
post_dash_lto: "post-lto", post_dash_lto: "post-lto",
@ -1129,7 +1092,6 @@ symbols! {
proc_dash_macro: "proc-macro", proc_dash_macro: "proc-macro",
proc_macro, proc_macro,
proc_macro_attribute, proc_macro_attribute,
proc_macro_def_site,
proc_macro_derive, proc_macro_derive,
proc_macro_expr, proc_macro_expr,
proc_macro_gen, proc_macro_gen,
@ -1230,9 +1192,6 @@ symbols! {
rust_cold_cc, rust_cold_cc,
rust_eh_catch_typeinfo, rust_eh_catch_typeinfo,
rust_eh_personality, rust_eh_personality,
rust_eh_register_frames,
rust_eh_unregister_frames,
rust_oom,
rustc, rustc,
rustc_allocator, rustc_allocator,
rustc_allocator_zeroed, rustc_allocator_zeroed,
@ -1305,7 +1264,6 @@ symbols! {
rustc_serialize, rustc_serialize,
rustc_skip_array_during_method_dispatch, rustc_skip_array_during_method_dispatch,
rustc_specialization_trait, rustc_specialization_trait,
rustc_stable,
rustc_std_internal_symbol, rustc_std_internal_symbol,
rustc_strict_coherence, rustc_strict_coherence,
rustc_symbol_name, rustc_symbol_name,
@ -1433,7 +1391,6 @@ symbols! {
static_recursion, static_recursion,
staticlib, staticlib,
std, std,
std_inject,
std_panic, std_panic,
std_panic_2015_macro, std_panic_2015_macro,
std_panic_macro, std_panic_macro,
@ -1448,7 +1405,6 @@ symbols! {
str_trim_start, str_trim_start,
strict_provenance, strict_provenance,
stringify, stringify,
stringify_macro,
struct_field_attributes, struct_field_attributes,
struct_inherit, struct_inherit,
struct_variant, struct_variant,
@ -1476,10 +1432,8 @@ symbols! {
target_has_atomic_load_store, target_has_atomic_load_store,
target_os, target_os,
target_pointer_width, target_pointer_width,
target_target_vendor,
target_thread_local, target_thread_local,
target_vendor, target_vendor,
task,
tbm_target_feature, tbm_target_feature,
termination, termination,
termination_trait, termination_trait,
@ -1491,7 +1445,6 @@ symbols! {
test_removed_feature, test_removed_feature,
test_runner, test_runner,
test_unstable_lint, test_unstable_lint,
then_with,
thread, thread,
thread_local, thread_local,
thread_local_macro, thread_local_macro,
@ -1523,7 +1476,6 @@ symbols! {
try_trait_v2, try_trait_v2,
tt, tt,
tuple, tuple,
tuple_from_req,
tuple_indexing, tuple_indexing,
tuple_trait, tuple_trait,
two_phase, two_phase,
@ -1567,7 +1519,6 @@ symbols! {
unreachable_2015, unreachable_2015,
unreachable_2015_macro, unreachable_2015_macro,
unreachable_2021, unreachable_2021,
unreachable_2021_macro,
unreachable_code, unreachable_code,
unreachable_display, unreachable_display,
unreachable_macro, unreachable_macro,
@ -1586,7 +1537,6 @@ symbols! {
from crates.io via `Cargo.toml` instead?", from crates.io via `Cargo.toml` instead?",
untagged_unions, untagged_unions,
unused_imports, unused_imports,
unused_qualifications,
unwind, unwind,
unwind_attributes, unwind_attributes,
unwind_safe_trait, unwind_safe_trait,

View File

@ -1054,7 +1054,6 @@ pub trait UpperHex {
pub trait Pointer { pub trait Pointer {
/// Formats the value using the given formatter. /// Formats the value using the given formatter.
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[rustc_diagnostic_item = "pointer_trait_fmt"]
fn fmt(&self, f: &mut Formatter<'_>) -> Result; fn fmt(&self, f: &mut Formatter<'_>) -> Result;
} }

View File

@ -338,7 +338,6 @@ pub macro debug_assert_matches($($arg:tt)*) {
/// ``` /// ```
#[macro_export] #[macro_export]
#[stable(feature = "matches_macro", since = "1.42.0")] #[stable(feature = "matches_macro", since = "1.42.0")]
#[cfg_attr(not(test), rustc_diagnostic_item = "matches_macro")]
macro_rules! matches { macro_rules! matches {
($expression:expr, $(|)? $( $pattern:pat_param )|+ $( if $guard: expr )? $(,)?) => { ($expression:expr, $(|)? $( $pattern:pat_param )|+ $( if $guard: expr )? $(,)?) => {
match $expression { match $expression {
@ -820,7 +819,6 @@ pub(crate) mod builtin {
#[stable(feature = "compile_error_macro", since = "1.20.0")] #[stable(feature = "compile_error_macro", since = "1.20.0")]
#[rustc_builtin_macro] #[rustc_builtin_macro]
#[macro_export] #[macro_export]
#[cfg_attr(not(test), rustc_diagnostic_item = "compile_error_macro")]
macro_rules! compile_error { macro_rules! compile_error {
($msg:expr $(,)?) => {{ /* compiler built-in */ }}; ($msg:expr $(,)?) => {{ /* compiler built-in */ }};
} }
@ -944,7 +942,6 @@ pub(crate) mod builtin {
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[rustc_builtin_macro] #[rustc_builtin_macro]
#[macro_export] #[macro_export]
#[cfg_attr(not(test), rustc_diagnostic_item = "env_macro")]
macro_rules! env { macro_rules! env {
($name:expr $(,)?) => {{ /* compiler built-in */ }}; ($name:expr $(,)?) => {{ /* compiler built-in */ }};
($name:expr, $error_msg:expr $(,)?) => {{ /* compiler built-in */ }}; ($name:expr, $error_msg:expr $(,)?) => {{ /* compiler built-in */ }};
@ -973,7 +970,6 @@ pub(crate) mod builtin {
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[rustc_builtin_macro] #[rustc_builtin_macro]
#[macro_export] #[macro_export]
#[cfg_attr(not(test), rustc_diagnostic_item = "option_env_macro")]
macro_rules! option_env { macro_rules! option_env {
($name:expr $(,)?) => {{ /* compiler built-in */ }}; ($name:expr $(,)?) => {{ /* compiler built-in */ }};
} }
@ -1058,7 +1054,6 @@ pub(crate) mod builtin {
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[rustc_builtin_macro] #[rustc_builtin_macro]
#[macro_export] #[macro_export]
#[cfg_attr(not(test), rustc_diagnostic_item = "concat_macro")]
macro_rules! concat { macro_rules! concat {
($($e:expr),* $(,)?) => {{ /* compiler built-in */ }}; ($($e:expr),* $(,)?) => {{ /* compiler built-in */ }};
} }
@ -1084,7 +1079,6 @@ pub(crate) mod builtin {
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[rustc_builtin_macro] #[rustc_builtin_macro]
#[macro_export] #[macro_export]
#[cfg_attr(not(test), rustc_diagnostic_item = "line_macro")]
macro_rules! line { macro_rules! line {
() => { () => {
/* compiler built-in */ /* compiler built-in */
@ -1124,7 +1118,6 @@ pub(crate) mod builtin {
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[rustc_builtin_macro] #[rustc_builtin_macro]
#[macro_export] #[macro_export]
#[cfg_attr(not(test), rustc_diagnostic_item = "column_macro")]
macro_rules! column { macro_rules! column {
() => { () => {
/* compiler built-in */ /* compiler built-in */
@ -1150,7 +1143,6 @@ pub(crate) mod builtin {
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[rustc_builtin_macro] #[rustc_builtin_macro]
#[macro_export] #[macro_export]
#[cfg_attr(not(test), rustc_diagnostic_item = "file_macro")]
macro_rules! file { macro_rules! file {
() => { () => {
/* compiler built-in */ /* compiler built-in */
@ -1175,7 +1167,6 @@ pub(crate) mod builtin {
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[rustc_builtin_macro] #[rustc_builtin_macro]
#[macro_export] #[macro_export]
#[cfg_attr(not(test), rustc_diagnostic_item = "stringify_macro")]
macro_rules! stringify { macro_rules! stringify {
($($t:tt)*) => { ($($t:tt)*) => {
/* compiler built-in */ /* compiler built-in */
@ -1282,7 +1273,6 @@ pub(crate) mod builtin {
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[rustc_builtin_macro] #[rustc_builtin_macro]
#[macro_export] #[macro_export]
#[cfg_attr(not(test), rustc_diagnostic_item = "module_path_macro")]
macro_rules! module_path { macro_rules! module_path {
() => { () => {
/* compiler built-in */ /* compiler built-in */
@ -1316,7 +1306,6 @@ pub(crate) mod builtin {
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[rustc_builtin_macro] #[rustc_builtin_macro]
#[macro_export] #[macro_export]
#[cfg_attr(not(test), rustc_diagnostic_item = "cfg_macro")]
macro_rules! cfg { macro_rules! cfg {
($($cfg:tt)*) => { ($($cfg:tt)*) => {
/* compiler built-in */ /* compiler built-in */
@ -1367,7 +1356,6 @@ pub(crate) mod builtin {
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[rustc_builtin_macro] #[rustc_builtin_macro]
#[macro_export] #[macro_export]
#[cfg_attr(not(test), rustc_diagnostic_item = "include_macro")]
macro_rules! include { macro_rules! include {
($file:expr $(,)?) => {{ /* compiler built-in */ }}; ($file:expr $(,)?) => {{ /* compiler built-in */ }};
} }

View File

@ -57,7 +57,6 @@ use crate::marker::Tuple;
#[cfg(bootstrap)] #[cfg(bootstrap)]
#[lang = "fn"] #[lang = "fn"]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[rustc_diagnostic_item = "Fn"]
#[rustc_paren_sugar] #[rustc_paren_sugar]
#[rustc_on_unimplemented( #[rustc_on_unimplemented(
on( on(
@ -138,7 +137,6 @@ pub trait Fn<Args>: FnMut<Args> {
#[cfg(not(bootstrap))] #[cfg(not(bootstrap))]
#[lang = "fn"] #[lang = "fn"]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[rustc_diagnostic_item = "Fn"]
#[rustc_paren_sugar] #[rustc_paren_sugar]
#[rustc_on_unimplemented( #[rustc_on_unimplemented(
on( on(
@ -227,7 +225,6 @@ pub trait Fn<Args: Tuple>: FnMut<Args> {
#[cfg(bootstrap)] #[cfg(bootstrap)]
#[lang = "fn_mut"] #[lang = "fn_mut"]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[rustc_diagnostic_item = "FnMut"]
#[rustc_paren_sugar] #[rustc_paren_sugar]
#[rustc_on_unimplemented( #[rustc_on_unimplemented(
on( on(
@ -316,7 +313,6 @@ pub trait FnMut<Args>: FnOnce<Args> {
#[cfg(not(bootstrap))] #[cfg(not(bootstrap))]
#[lang = "fn_mut"] #[lang = "fn_mut"]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[rustc_diagnostic_item = "FnMut"]
#[rustc_paren_sugar] #[rustc_paren_sugar]
#[rustc_on_unimplemented( #[rustc_on_unimplemented(
on( on(
@ -397,7 +393,6 @@ pub trait FnMut<Args: Tuple>: FnOnce<Args> {
#[cfg(bootstrap)] #[cfg(bootstrap)]
#[lang = "fn_once"] #[lang = "fn_once"]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[rustc_diagnostic_item = "FnOnce"]
#[rustc_paren_sugar] #[rustc_paren_sugar]
#[rustc_on_unimplemented( #[rustc_on_unimplemented(
on( on(
@ -483,7 +478,6 @@ pub trait FnOnce<Args> {
#[cfg(not(bootstrap))] #[cfg(not(bootstrap))]
#[lang = "fn_once"] #[lang = "fn_once"]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[rustc_diagnostic_item = "FnOnce"]
#[rustc_paren_sugar] #[rustc_paren_sugar]
#[rustc_on_unimplemented( #[rustc_on_unimplemented(
on( on(

View File

@ -80,7 +80,6 @@ pub macro unreachable_2015 {
#[doc(hidden)] #[doc(hidden)]
#[unstable(feature = "edition_panic", issue = "none", reason = "use unreachable!() instead")] #[unstable(feature = "edition_panic", issue = "none", reason = "use unreachable!() instead")]
#[allow_internal_unstable(core_panic)] #[allow_internal_unstable(core_panic)]
#[rustc_diagnostic_item = "unreachable_2021_macro"]
#[rustc_macro_transparency = "semitransparent"] #[rustc_macro_transparency = "semitransparent"]
pub macro unreachable_2021 { pub macro unreachable_2021 {
() => ( () => (

View File

@ -73,7 +73,6 @@ pub enum IpAddr {
/// assert!("0xcb.0x0.0x71.0x00".parse::<Ipv4Addr>().is_err()); // all octets are in hex /// assert!("0xcb.0x0.0x71.0x00".parse::<Ipv4Addr>().is_err()); // all octets are in hex
/// ``` /// ```
#[derive(Copy, Clone, PartialEq, Eq, Hash)] #[derive(Copy, Clone, PartialEq, Eq, Hash)]
#[cfg_attr(not(test), rustc_diagnostic_item = "Ipv4Addr")]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct Ipv4Addr { pub struct Ipv4Addr {
octets: [u8; 4], octets: [u8; 4],
@ -156,7 +155,6 @@ pub struct Ipv4Addr {
/// assert_eq!(localhost.is_loopback(), true); /// assert_eq!(localhost.is_loopback(), true);
/// ``` /// ```
#[derive(Copy, Clone, PartialEq, Eq, Hash)] #[derive(Copy, Clone, PartialEq, Eq, Hash)]
#[cfg_attr(not(test), rustc_diagnostic_item = "Ipv6Addr")]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct Ipv6Addr { pub struct Ipv6Addr {
octets: [u8; 16], octets: [u8; 16],

View File

@ -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 { pub fn is_panic(cx: &LateContext<'_>, def_id: DefId) -> bool {
let Some(name) = cx.tcx.get_diagnostic_name(def_id) else { return false }; let Some(name) = cx.tcx.get_diagnostic_name(def_id) else { return false };
matches!( matches!(
name.as_str(), name,
"core_panic_macro" sym::core_panic_macro
| "std_panic_macro" | sym::std_panic_macro
| "core_panic_2015_macro" | sym::core_panic_2015_macro
| "std_panic_2015_macro" | sym::std_panic_2015_macro
| "core_panic_2021_macro" | sym::core_panic_2021_macro
) )
} }