Remove hir::StmtKind::attrs.

This commit is contained in:
Camille GILLOT 2020-11-25 22:07:09 +01:00
parent 4bb07bedf5
commit ff79ad394f
2 changed files with 1 additions and 11 deletions

View File

@ -1169,16 +1169,6 @@ pub enum StmtKind<'hir> {
Semi(&'hir Expr<'hir>),
}
impl<'hir> StmtKind<'hir> {
pub fn attrs(&self, get_item: impl FnOnce(ItemId) -> &'hir Item<'hir>) -> &'hir [Attribute] {
match *self {
StmtKind::Local(ref l) => &l.attrs,
StmtKind::Item(ref item_id) => &get_item(*item_id).attrs,
StmtKind::Expr(ref e) | StmtKind::Semi(ref e) => &e.attrs,
}
}
}
/// Represents a `let` statement (i.e., `let <pat>:<ty> = <expr>;`).
#[derive(Debug, HashStable_Generic)]
pub struct Local<'hir> {

View File

@ -109,7 +109,7 @@ impl<'tcx> LateLintPass<'tcx> for DeepCodeInspector {
}
fn check_stmt(&mut self, cx: &LateContext<'tcx>, stmt: &'tcx hir::Stmt<'_>) {
if !has_attr(cx.sess(), stmt.kind.attrs(|id| cx.tcx.hir().item(id))) {
if !has_attr(cx.sess(), cx.tcx.hir().attrs(stmt.hir_id)) {
return;
}
match stmt.kind {