1
Fork 0

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...
This commit is contained in:
Maybe Waffle 2022-11-13 22:58:20 +00:00
parent 4ed2bf6802
commit 29fe28fcfc
3 changed files with 9 additions and 6 deletions

View file

@ -542,6 +542,7 @@ symbols! {
core, core,
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,
@ -621,6 +622,7 @@ symbols! {
doc_primitive, doc_primitive,
doc_spotlight, doc_spotlight,
doctest, doctest,
document_private_items,
dotdot: "..", dotdot: "..",
dotdot_in_tuple_patterns, dotdot_in_tuple_patterns,
dotdoteq_in_patterns, dotdoteq_in_patterns,

View file

@ -43,6 +43,7 @@ pub macro panic_2015 {
#[doc(hidden)] #[doc(hidden)]
#[unstable(feature = "edition_panic", issue = "none", reason = "use panic!() instead")] #[unstable(feature = "edition_panic", issue = "none", reason = "use panic!() instead")]
#[allow_internal_unstable(core_panic, const_format_args)] #[allow_internal_unstable(core_panic, const_format_args)]
#[rustc_diagnostic_item = "core_panic_2021_macro"]
#[rustc_macro_transparency = "semitransparent"] #[rustc_macro_transparency = "semitransparent"]
pub macro panic_2021 { pub macro panic_2021 {
() => ( () => (

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
) )
} }