Skip to content

Commit c49966b

Browse files
committed
Clarify variable names when checking track_caller methods.
1 parent 190212c commit c49966b

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/librustc_typeck/check/wfcheck.rs

+4-5
Original file line numberDiff line numberDiff line change
@@ -196,19 +196,18 @@ pub fn check_impl_item(tcx: TyCtxt<'_>, def_id: DefId) {
196196
};
197197

198198
// Prohibits applying `#[track_caller]` to trait impls
199-
if method_sig.is_some() {
199+
if method_sig.is_some() {
200200
let track_caller_attr = impl_item.attrs.iter()
201201
.find(|a| a.check_name(sym::track_caller));
202202
if let Some(tc_attr) = track_caller_attr {
203203
let parent_hir_id = tcx.hir().get_parent_item(hir_id);
204204
let containing_item = tcx.hir().expect_item(parent_hir_id);
205-
let containing_impl_trait_ref = match &containing_item.kind {
206-
hir::ItemKind::Impl(_, _, _, _, tr, _, _) => tr,
205+
let containing_impl_is_for_trait = match &containing_item.kind {
206+
hir::ItemKind::Impl(_, _, _, _, tr, _, _) => tr.is_some(),
207207
_ => bug!("parent of an ImplItem must be an Impl"),
208208
};
209209

210-
// if the impl block this item is within is for a trait...
211-
if containing_impl_trait_ref.is_some() {
210+
if containing_impl_is_for_trait {
212211
struct_span_err!(
213212
tcx.sess,
214213
tc_attr.span,

0 commit comments

Comments
 (0)