Skip to content

Commit ff79ad3

Browse files
committed
Remove hir::StmtKind::attrs.
1 parent 4bb07be commit ff79ad3

File tree

2 files changed

+1
-11
lines changed

2 files changed

+1
-11
lines changed

compiler/rustc_hir/src/hir.rs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1169,16 +1169,6 @@ pub enum StmtKind<'hir> {
11691169
Semi(&'hir Expr<'hir>),
11701170
}
11711171

1172-
impl<'hir> StmtKind<'hir> {
1173-
pub fn attrs(&self, get_item: impl FnOnce(ItemId) -> &'hir Item<'hir>) -> &'hir [Attribute] {
1174-
match *self {
1175-
StmtKind::Local(ref l) => &l.attrs,
1176-
StmtKind::Item(ref item_id) => &get_item(*item_id).attrs,
1177-
StmtKind::Expr(ref e) | StmtKind::Semi(ref e) => &e.attrs,
1178-
}
1179-
}
1180-
}
1181-
11821172
/// Represents a `let` statement (i.e., `let <pat>:<ty> = <expr>;`).
11831173
#[derive(Debug, HashStable_Generic)]
11841174
pub struct Local<'hir> {

src/tools/clippy/clippy_lints/src/utils/inspector.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ impl<'tcx> LateLintPass<'tcx> for DeepCodeInspector {
109109
}
110110

111111
fn check_stmt(&mut self, cx: &LateContext<'tcx>, stmt: &'tcx hir::Stmt<'_>) {
112-
if !has_attr(cx.sess(), stmt.kind.attrs(|id| cx.tcx.hir().item(id))) {
112+
if !has_attr(cx.sess(), cx.tcx.hir().attrs(stmt.hir_id)) {
113113
return;
114114
}
115115
match stmt.kind {

0 commit comments

Comments
 (0)