Skip to content

Commit 29fe28f

Browse files
committed
Fix clippy and rustdoc
please, please, don't match on `Symbol::as_str`s, every time you do, somewhere in the world another waffle becomes sad...
1 parent 4ed2bf6 commit 29fe28f

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

compiler/rustc_span/src/symbol.rs

+2
Original file line numberDiff line numberDiff line change
@@ -542,6 +542,7 @@ symbols! {
542542
core,
543543
core_panic,
544544
core_panic_2015_macro,
545+
core_panic_2021_macro,
545546
core_panic_macro,
546547
cosf32,
547548
cosf64,
@@ -621,6 +622,7 @@ symbols! {
621622
doc_primitive,
622623
doc_spotlight,
623624
doctest,
625+
document_private_items,
624626
dotdot: "..",
625627
dotdot_in_tuple_patterns,
626628
dotdoteq_in_patterns,

library/core/src/panic.rs

+1
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ pub macro panic_2015 {
4343
#[doc(hidden)]
4444
#[unstable(feature = "edition_panic", issue = "none", reason = "use panic!() instead")]
4545
#[allow_internal_unstable(core_panic, const_format_args)]
46+
#[rustc_diagnostic_item = "core_panic_2021_macro"]
4647
#[rustc_macro_transparency = "semitransparent"]
4748
pub macro panic_2021 {
4849
() => (

src/tools/clippy/clippy_utils/src/macros.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -199,12 +199,12 @@ pub fn first_node_in_macro(cx: &LateContext<'_>, node: &impl HirNode) -> Option<
199199
pub fn is_panic(cx: &LateContext<'_>, def_id: DefId) -> bool {
200200
let Some(name) = cx.tcx.get_diagnostic_name(def_id) else { return false };
201201
matches!(
202-
name.as_str(),
203-
"core_panic_macro"
204-
| "std_panic_macro"
205-
| "core_panic_2015_macro"
206-
| "std_panic_2015_macro"
207-
| "core_panic_2021_macro"
202+
name,
203+
sym::core_panic_macro
204+
| sym::std_panic_macro
205+
| sym::core_panic_2015_macro
206+
| sym::std_panic_2015_macro
207+
| sym::core_panic_2021_macro
208208
)
209209
}
210210

0 commit comments

Comments
 (0)