Skip to content

Commit 7e2ccb0

Browse files
committed
Remove region from UpvarCapture and move it to CapturedPlace
Region info is completely unnecessary for upvar capture kind computation and is only needed to create the final upvar tuple ty. Doing so makes creation of UpvarCapture very cheap and expose further cleanup opportunity.
1 parent 356b024 commit 7e2ccb0

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

clippy_utils/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -970,7 +970,7 @@ pub fn can_move_expr_to_closure(cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) ->
970970
if !self.locals.contains(&local_id) {
971971
let capture = match capture.info.capture_kind {
972972
UpvarCapture::ByValue => CaptureKind::Value,
973-
UpvarCapture::ByRef(borrow) => match borrow.kind {
973+
UpvarCapture::ByRef(kind) => match kind {
974974
BorrowKind::ImmBorrow => CaptureKind::Ref(Mutability::Not),
975975
BorrowKind::UniqueImmBorrow | BorrowKind::MutBorrow => {
976976
CaptureKind::Ref(Mutability::Mut)

0 commit comments

Comments
 (0)