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