Remove hir::StmtKind::attrs.
This commit is contained in:
parent
4bb07bedf5
commit
ff79ad394f
2 changed files with 1 additions and 11 deletions
|
@ -1169,16 +1169,6 @@ pub enum StmtKind<'hir> {
|
||||||
Semi(&'hir Expr<'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>;`).
|
/// Represents a `let` statement (i.e., `let <pat>:<ty> = <expr>;`).
|
||||||
#[derive(Debug, HashStable_Generic)]
|
#[derive(Debug, HashStable_Generic)]
|
||||||
pub struct Local<'hir> {
|
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<'_>) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
match stmt.kind {
|
match stmt.kind {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue