Skip to content

Commit fd60581

Browse files
committed
Address review take 2
1 parent 6f5d648 commit fd60581

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

clippy_utils/src/check_proc_macro.rs

+11-9
Original file line numberDiff line numberDiff line change
@@ -256,16 +256,18 @@ fn fn_kind_pat(tcx: TyCtxt<'_>, kind: &FnKind<'_>, body: &Body<'_>, hir_id: HirI
256256
FnKind::Method(.., sig) => (fn_header_search_pat(sig.header), Pat::Str("")),
257257
FnKind::Closure => return (Pat::Str(""), expr_search_pat(tcx, &body.value).1),
258258
};
259-
let vis_span = match tcx.hir().get(hir_id) {
260-
Node::Item(Item { vis_span, .. }) | Node::ImplItem(ImplItem { vis_span, .. }) => Some(vis_span),
261-
Node::TraitItem(_) => None,
262-
_ => unreachable!(),
259+
let start_pat = match tcx.hir().get(hir_id) {
260+
Node::Item(Item { vis_span, .. }) | Node::ImplItem(ImplItem { vis_span, .. }) => {
261+
if vis_span.is_empty() {
262+
start_pat
263+
} else {
264+
Pat::Str("pub")
265+
}
266+
},
267+
Node::TraitItem(_) => start_pat,
268+
_ => Pat::Str(""),
263269
};
264-
if matches!(vis_span, Some(span) if span.is_empty()) {
265-
(start_pat, end_pat)
266-
} else {
267-
(Pat::Str("pub"), end_pat)
268-
}
270+
(start_pat, end_pat)
269271
}
270272

271273
pub trait WithSearchPat {

0 commit comments

Comments
 (0)