mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 23:04:33 +00:00
Remove hir::Local::attrs.
This commit is contained in:
parent
ff79ad394f
commit
7ea1eacb17
@ -1800,8 +1800,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
|
||||
});
|
||||
let init = l.init.as_ref().map(|e| self.lower_expr(e));
|
||||
let hir_id = self.lower_node_id(l.id);
|
||||
let attrs = l.attrs.iter().map(|a| self.lower_attr(a)).collect::<Vec<_>>();
|
||||
self.attrs.push_sparse(hir_id, &*self.arena.alloc_from_iter(attrs.iter().cloned()));
|
||||
self.lower_attrs(hir_id, &l.attrs);
|
||||
(
|
||||
hir::Local {
|
||||
hir_id,
|
||||
@ -1809,7 +1808,6 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
|
||||
pat: self.lower_pat(&l.pat),
|
||||
init,
|
||||
span: l.span,
|
||||
attrs: attrs.into(),
|
||||
source: hir::LocalSource::Normal,
|
||||
},
|
||||
ids,
|
||||
@ -2534,15 +2532,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
|
||||
) -> hir::Stmt<'hir> {
|
||||
let hir_id = self.next_id();
|
||||
self.attrs.push_sparse(hir_id, attrs);
|
||||
let local = hir::Local {
|
||||
attrs: attrs.iter().cloned().collect::<Vec<_>>().into(),
|
||||
hir_id,
|
||||
init,
|
||||
pat,
|
||||
source,
|
||||
span,
|
||||
ty: None,
|
||||
};
|
||||
let local = hir::Local { hir_id, init, pat, source, span, ty: None };
|
||||
self.stmt(span, hir::StmtKind::Local(self.arena.alloc(local)))
|
||||
}
|
||||
|
||||
|
@ -1179,7 +1179,6 @@ pub struct Local<'hir> {
|
||||
pub init: Option<&'hir Expr<'hir>>,
|
||||
pub hir_id: HirId,
|
||||
pub span: Span,
|
||||
pub attrs: AttrVec,
|
||||
/// Can be `ForLoopDesugar` if the `let` statement is part of a `for` loop
|
||||
/// desugaring. Otherwise will be `Normal`.
|
||||
pub source: LocalSource,
|
||||
|
@ -81,7 +81,7 @@ impl<'tcx> LateLintPass<'tcx> for Return {
|
||||
if let Some(stmt) = block.stmts.iter().last();
|
||||
if let StmtKind::Local(local) = &stmt.kind;
|
||||
if local.ty.is_none();
|
||||
if local.attrs.is_empty();
|
||||
if cx.tcx.hir().attrs(local.hir_id).is_empty();
|
||||
if let Some(initexpr) = &local.init;
|
||||
if let PatKind::Binding(.., ident, _) = local.pat.kind;
|
||||
if let ExprKind::Path(qpath) = &retexpr.kind;
|
||||
|
Loading…
Reference in New Issue
Block a user