Auto merge of #3591 - flip1995:rustup, r=phansch
Match on ast/hir::ExprKind::Err rustup rust-lang/rust#56999
This commit is contained in:
commit
32b3bc231b
@ -756,7 +756,8 @@ fn never_loop_expr(expr: &Expr, main_loop_id: NodeId) -> NeverLoopResult {
|
|||||||
| ExprKind::Closure(_, _, _, _, _)
|
| ExprKind::Closure(_, _, _, _, _)
|
||||||
| ExprKind::InlineAsm(_, _, _)
|
| ExprKind::InlineAsm(_, _, _)
|
||||||
| ExprKind::Path(_)
|
| ExprKind::Path(_)
|
||||||
| ExprKind::Lit(_) => NeverLoopResult::Otherwise,
|
| ExprKind::Lit(_)
|
||||||
|
| ExprKind::Err => NeverLoopResult::Otherwise,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -504,6 +504,9 @@ fn visit_expr(&mut self, expr: &Expr) {
|
|||||||
self.current = value_pat;
|
self.current = value_pat;
|
||||||
self.visit_expr(value);
|
self.visit_expr(value);
|
||||||
},
|
},
|
||||||
|
ExprKind::Err => {
|
||||||
|
println!("Err = {}", current);
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -615,6 +615,7 @@ pub fn hash_expr(&mut self, e: &Expr) {
|
|||||||
self.hash_name(l.ident.name);
|
self.hash_name(l.ident.name);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
ExprKind::Err => {},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -347,6 +347,9 @@ fn print_expr(cx: &LateContext<'_, '_>, expr: &hir::Expr, indent: usize) {
|
|||||||
println!("{}repeat count:", ind);
|
println!("{}repeat count:", ind);
|
||||||
print_expr(cx, &cx.tcx.hir().body(anon_const.body).value, indent + 1);
|
print_expr(cx, &cx.tcx.hir().body(anon_const.body).value, indent + 1);
|
||||||
},
|
},
|
||||||
|
hir::ExprKind::Err => {
|
||||||
|
println!("{}Err", ind);
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,7 +79,8 @@ pub fn hir_opt(cx: &LateContext<'_, '_>, expr: &hir::Expr) -> Option<Self> {
|
|||||||
| hir::ExprKind::Ret(..)
|
| hir::ExprKind::Ret(..)
|
||||||
| hir::ExprKind::Struct(..)
|
| hir::ExprKind::Struct(..)
|
||||||
| hir::ExprKind::Tup(..)
|
| hir::ExprKind::Tup(..)
|
||||||
| hir::ExprKind::While(..) => Sugg::NonParen(snippet),
|
| hir::ExprKind::While(..)
|
||||||
|
| hir::ExprKind::Err => Sugg::NonParen(snippet),
|
||||||
hir::ExprKind::Assign(..) => Sugg::BinOp(AssocOp::Assign, snippet),
|
hir::ExprKind::Assign(..) => Sugg::BinOp(AssocOp::Assign, snippet),
|
||||||
hir::ExprKind::AssignOp(op, ..) => Sugg::BinOp(hirbinop2assignop(op), snippet),
|
hir::ExprKind::AssignOp(op, ..) => Sugg::BinOp(hirbinop2assignop(op), snippet),
|
||||||
hir::ExprKind::Binary(op, ..) => Sugg::BinOp(AssocOp::from_ast_binop(higher::binop(op.node)), snippet),
|
hir::ExprKind::Binary(op, ..) => Sugg::BinOp(AssocOp::from_ast_binop(higher::binop(op.node)), snippet),
|
||||||
@ -158,7 +159,8 @@ pub fn ast(cx: &EarlyContext<'_>, expr: &ast::Expr, default: &'a str) -> Self {
|
|||||||
| ast::ExprKind::Tup(..)
|
| ast::ExprKind::Tup(..)
|
||||||
| ast::ExprKind::Array(..)
|
| ast::ExprKind::Array(..)
|
||||||
| ast::ExprKind::While(..)
|
| ast::ExprKind::While(..)
|
||||||
| ast::ExprKind::WhileLet(..) => Sugg::NonParen(snippet),
|
| ast::ExprKind::WhileLet(..)
|
||||||
|
| ast::ExprKind::Err => Sugg::NonParen(snippet),
|
||||||
ast::ExprKind::Range(.., RangeLimits::HalfOpen) => Sugg::BinOp(AssocOp::DotDot, snippet),
|
ast::ExprKind::Range(.., RangeLimits::HalfOpen) => Sugg::BinOp(AssocOp::DotDot, snippet),
|
||||||
ast::ExprKind::Range(.., RangeLimits::Closed) => Sugg::BinOp(AssocOp::DotDotEq, snippet),
|
ast::ExprKind::Range(.., RangeLimits::Closed) => Sugg::BinOp(AssocOp::DotDotEq, snippet),
|
||||||
ast::ExprKind::Assign(..) => Sugg::BinOp(AssocOp::Assign, snippet),
|
ast::ExprKind::Assign(..) => Sugg::BinOp(AssocOp::Assign, snippet),
|
||||||
|
Loading…
Reference in New Issue
Block a user