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 init = l.init.as_ref().map(|e| self.lower_expr(e));
|
||||||
let hir_id = self.lower_node_id(l.id);
|
let hir_id = self.lower_node_id(l.id);
|
||||||
let attrs = l.attrs.iter().map(|a| self.lower_attr(a)).collect::<Vec<_>>();
|
self.lower_attrs(hir_id, &l.attrs);
|
||||||
self.attrs.push_sparse(hir_id, &*self.arena.alloc_from_iter(attrs.iter().cloned()));
|
|
||||||
(
|
(
|
||||||
hir::Local {
|
hir::Local {
|
||||||
hir_id,
|
hir_id,
|
||||||
@ -1809,7 +1808,6 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
|
|||||||
pat: self.lower_pat(&l.pat),
|
pat: self.lower_pat(&l.pat),
|
||||||
init,
|
init,
|
||||||
span: l.span,
|
span: l.span,
|
||||||
attrs: attrs.into(),
|
|
||||||
source: hir::LocalSource::Normal,
|
source: hir::LocalSource::Normal,
|
||||||
},
|
},
|
||||||
ids,
|
ids,
|
||||||
@ -2534,15 +2532,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
|
|||||||
) -> hir::Stmt<'hir> {
|
) -> hir::Stmt<'hir> {
|
||||||
let hir_id = self.next_id();
|
let hir_id = self.next_id();
|
||||||
self.attrs.push_sparse(hir_id, attrs);
|
self.attrs.push_sparse(hir_id, attrs);
|
||||||
let local = hir::Local {
|
let local = hir::Local { hir_id, init, pat, source, span, ty: None };
|
||||||
attrs: attrs.iter().cloned().collect::<Vec<_>>().into(),
|
|
||||||
hir_id,
|
|
||||||
init,
|
|
||||||
pat,
|
|
||||||
source,
|
|
||||||
span,
|
|
||||||
ty: None,
|
|
||||||
};
|
|
||||||
self.stmt(span, hir::StmtKind::Local(self.arena.alloc(local)))
|
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 init: Option<&'hir Expr<'hir>>,
|
||||||
pub hir_id: HirId,
|
pub hir_id: HirId,
|
||||||
pub span: Span,
|
pub span: Span,
|
||||||
pub attrs: AttrVec,
|
|
||||||
/// Can be `ForLoopDesugar` if the `let` statement is part of a `for` loop
|
/// Can be `ForLoopDesugar` if the `let` statement is part of a `for` loop
|
||||||
/// desugaring. Otherwise will be `Normal`.
|
/// desugaring. Otherwise will be `Normal`.
|
||||||
pub source: LocalSource,
|
pub source: LocalSource,
|
||||||
|
@ -81,7 +81,7 @@ impl<'tcx> LateLintPass<'tcx> for Return {
|
|||||||
if let Some(stmt) = block.stmts.iter().last();
|
if let Some(stmt) = block.stmts.iter().last();
|
||||||
if let StmtKind::Local(local) = &stmt.kind;
|
if let StmtKind::Local(local) = &stmt.kind;
|
||||||
if local.ty.is_none();
|
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 Some(initexpr) = &local.init;
|
||||||
if let PatKind::Binding(.., ident, _) = local.pat.kind;
|
if let PatKind::Binding(.., ident, _) = local.pat.kind;
|
||||||
if let ExprKind::Path(qpath) = &retexpr.kind;
|
if let ExprKind::Path(qpath) = &retexpr.kind;
|
||||||
|
Loading…
Reference in New Issue
Block a user