remove unnecessary nested blocks
This commit is contained in:
parent
6af09d2505
commit
e0919de0fd
1 changed files with 8 additions and 12 deletions
|
@ -2296,22 +2296,18 @@ impl<'a: 'ast, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
|
||||||
|
|
||||||
let prev = self.diagnostic_metadata.current_block_could_be_bare_struct_literal.take();
|
let prev = self.diagnostic_metadata.current_block_could_be_bare_struct_literal.take();
|
||||||
if let (true, [Stmt { kind: StmtKind::Expr(expr), .. }]) =
|
if let (true, [Stmt { kind: StmtKind::Expr(expr), .. }]) =
|
||||||
(block.could_be_bare_literal, &block.stmts[..])
|
(block.could_be_bare_literal, &block.stmts[..]) && let ExprKind::Type(..) = expr.kind
|
||||||
{
|
{
|
||||||
if let ExprKind::Type(..) = expr.kind {
|
self.diagnostic_metadata.current_block_could_be_bare_struct_literal =
|
||||||
self.diagnostic_metadata.current_block_could_be_bare_struct_literal =
|
Some(block.span);
|
||||||
Some(block.span);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// Descend into the block.
|
// Descend into the block.
|
||||||
for stmt in &block.stmts {
|
for stmt in &block.stmts {
|
||||||
if let StmtKind::Item(ref item) = stmt.kind {
|
if let StmtKind::Item(ref item) = stmt.kind && let ItemKind::MacroDef(..) = item.kind {
|
||||||
if let ItemKind::MacroDef(..) = item.kind {
|
num_macro_definition_ribs += 1;
|
||||||
num_macro_definition_ribs += 1;
|
let res = self.r.local_def_id(item.id).to_def_id();
|
||||||
let res = self.r.local_def_id(item.id).to_def_id();
|
self.ribs[ValueNS].push(Rib::new(MacroDefinition(res)));
|
||||||
self.ribs[ValueNS].push(Rib::new(MacroDefinition(res)));
|
self.label_ribs.push(Rib::new(MacroDefinition(res)));
|
||||||
self.label_ribs.push(Rib::new(MacroDefinition(res)));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
self.visit_stmt(stmt);
|
self.visit_stmt(stmt);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue