1
Fork 0

Also fix if in else

This commit is contained in:
Michael Goulet 2024-09-11 17:23:56 -04:00
parent 954419aab0
commit af8d911d63
27 changed files with 223 additions and 291 deletions

View file

@ -2172,17 +2172,13 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
attr.span,
errors::MacroExport::TooManyItems,
);
} else {
if meta_item_list[0].name_or_empty() != sym::local_inner_macros {
self.tcx.emit_node_span_lint(
INVALID_MACRO_EXPORT_ARGUMENTS,
hir_id,
meta_item_list[0].span(),
errors::MacroExport::UnknownItem {
name: meta_item_list[0].name_or_empty(),
},
);
}
} else if meta_item_list[0].name_or_empty() != sym::local_inner_macros {
self.tcx.emit_node_span_lint(
INVALID_MACRO_EXPORT_ARGUMENTS,
hir_id,
meta_item_list[0].span(),
errors::MacroExport::UnknownItem { name: meta_item_list[0].name_or_empty() },
);
}
} else {
// special case when `#[macro_export]` is applied to a macro 2.0

View file

@ -1500,15 +1500,13 @@ impl<'tcx> Liveness<'_, 'tcx> {
);
}
}
} else {
if let Some(name) = self.should_warn(var) {
self.ir.tcx.emit_node_span_lint(
lint::builtin::UNUSED_VARIABLES,
var_hir_id,
vec![span],
errors::UnusedVarMaybeCaptureRef { name },
);
}
} else if let Some(name) = self.should_warn(var) {
self.ir.tcx.emit_node_span_lint(
lint::builtin::UNUSED_VARIABLES,
var_hir_id,
vec![span],
errors::UnusedVarMaybeCaptureRef { name },
);
}
}
}