mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-10 14:02:57 +00:00
Remove hir::StmtKind::attrs.
This commit is contained in:
parent
4bb07bedf5
commit
ff79ad394f
@ -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> {
|
||||
|
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user