mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-27 01:04:03 +00:00
Support hir::ExprKind::Become
in clippy
This commit is contained in:
parent
ccb71ff424
commit
e38576a893
@ -206,6 +206,12 @@ fn never_loop_expr(expr: &Expr<'_>, ignore_ids: &mut Vec<HirId>, main_loop_id: H
|
||||
NeverLoopResult::AlwaysBreak,
|
||||
)
|
||||
}),
|
||||
ExprKind::Become(e) => {
|
||||
combine_seq(
|
||||
never_loop_expr(e, ignore_ids, main_loop_id),
|
||||
NeverLoopResult::AlwaysBreak,
|
||||
)
|
||||
}
|
||||
ExprKind::InlineAsm(asm) => asm
|
||||
.operands
|
||||
.iter()
|
||||
|
@ -329,6 +329,7 @@ impl<'a, 'tcx> Visitor<'tcx> for SigDropHelper<'a, 'tcx> {
|
||||
ExprKind::Field(..) |
|
||||
ExprKind::Index(..) |
|
||||
ExprKind::Ret(..) |
|
||||
ExprKind::Become(..) |
|
||||
ExprKind::Repeat(..) |
|
||||
ExprKind::Yield(..) => walk_expr(self, ex),
|
||||
ExprKind::AddrOf(_, _, _) |
|
||||
|
@ -559,6 +559,11 @@ impl<'a, 'tcx> PrintVisitor<'a, 'tcx> {
|
||||
kind!("Ret({value})");
|
||||
value.if_some(|e| self.expr(e));
|
||||
},
|
||||
ExprKind::Become(value) => {
|
||||
bind!(self, value);
|
||||
kind!("Become({value})");
|
||||
self.expr(value);
|
||||
},
|
||||
ExprKind::InlineAsm(_) => {
|
||||
kind!("InlineAsm(_)");
|
||||
out!("// unimplemented: `ExprKind::InlineAsm` is not further destructured at the moment");
|
||||
|
@ -191,6 +191,7 @@ fn expr_eagerness<'tcx>(cx: &LateContext<'tcx>, e: &'tcx Expr<'_>) -> EagernessS
|
||||
ExprKind::Break(..)
|
||||
| ExprKind::Continue(_)
|
||||
| ExprKind::Ret(_)
|
||||
| ExprKind::Become(_)
|
||||
| ExprKind::InlineAsm(_)
|
||||
| ExprKind::Yield(..)
|
||||
| ExprKind::Err(_) => {
|
||||
|
@ -845,6 +845,9 @@ impl<'a, 'tcx> SpanlessHash<'a, 'tcx> {
|
||||
self.hash_expr(e);
|
||||
}
|
||||
},
|
||||
ExprKind::Become(f) => {
|
||||
self.hash_expr(f);
|
||||
},
|
||||
ExprKind::Path(ref qpath) => {
|
||||
self.hash_qpath(qpath);
|
||||
},
|
||||
|
@ -147,6 +147,7 @@ impl<'a> Sugg<'a> {
|
||||
| hir::ExprKind::Path(..)
|
||||
| hir::ExprKind::Repeat(..)
|
||||
| hir::ExprKind::Ret(..)
|
||||
| hir::ExprKind::Become(..)
|
||||
| hir::ExprKind::Struct(..)
|
||||
| hir::ExprKind::Tup(..)
|
||||
| hir::ExprKind::Err(_) => Sugg::NonParen(get_snippet(expr.span)),
|
||||
|
@ -651,6 +651,7 @@ pub fn for_each_unconsumed_temporary<'tcx, B>(
|
||||
// Either drops temporaries, jumps out of the current expression, or has no sub expression.
|
||||
ExprKind::DropTemps(_)
|
||||
| ExprKind::Ret(_)
|
||||
| ExprKind::Become(_)
|
||||
| ExprKind::Break(..)
|
||||
| ExprKind::Yield(..)
|
||||
| ExprKind::Block(..)
|
||||
|
Loading…
Reference in New Issue
Block a user