Skip to content

Commit 1b7f6ac

Browse files
dingxiangfei2009ehuss
authored andcommitted
clippy
1 parent f85fb2e commit 1b7f6ac

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

compiler/rustc_mir_transform/src/lint_tail_expr_drop_order.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ impl<'a, 'mir, 'tcx> DropsReachable<'a, 'mir, 'tcx> {
6363
// we will try to update the successor blocks.
6464
// An occupied entry at `block` in `self.visited` signals that we have visited `block` before.
6565
let dropped_local_here =
66-
self.visited.entry(block).or_insert_with(make_new_path_set).clone();
66+
Rc::clone(self.visited.entry(block).or_insert_with(make_new_path_set));
6767
// We could have invoked reverse lookup for a `MovePathIndex` every time, but unfortunately it is expensive.
6868
// Let's cache them in `self.block_drop_value_info`.
6969
match self.block_drop_value_info[block] {
@@ -119,11 +119,11 @@ impl<'a, 'mir, 'tcx> DropsReachable<'a, 'mir, 'tcx> {
119119
// so we can bail on `succ` until new drop information arrives
120120
continue;
121121
}
122-
occupied_entry.get().clone()
122+
Rc::clone(occupied_entry.get())
123123
}
124-
hash_map::Entry::Vacant(vacant_entry) => vacant_entry
125-
.insert(Rc::new(RefCell::new(dropped_local_here.borrow().clone())))
126-
.clone(),
124+
hash_map::Entry::Vacant(vacant_entry) => Rc::clone(
125+
vacant_entry.insert(Rc::new(RefCell::new(dropped_local_here.borrow().clone()))),
126+
),
127127
};
128128
if let Some(terminator) = &target.terminator
129129
&& let TerminatorKind::Drop {

tests/ui/thir-print/thir-tree-match.stdout

+6-6
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ body:
123123
body:
124124
Expr {
125125
ty: bool
126-
temp_lifetime: TempLifetime { temp_lifetime: Some(Node(12)), backwards_incompatible: None }
126+
temp_lifetime: TempLifetime { temp_lifetime: Some(Node(13)), backwards_incompatible: None }
127127
span: $DIR/thir-tree-match.rs:17:36: 17:40 (#0)
128128
kind:
129129
Scope {
@@ -132,7 +132,7 @@ body:
132132
value:
133133
Expr {
134134
ty: bool
135-
temp_lifetime: TempLifetime { temp_lifetime: Some(Node(12)), backwards_incompatible: None }
135+
temp_lifetime: TempLifetime { temp_lifetime: Some(Node(13)), backwards_incompatible: None }
136136
span: $DIR/thir-tree-match.rs:17:36: 17:40 (#0)
137137
kind:
138138
Literal( lit: Spanned { node: Bool(true), span: $DIR/thir-tree-match.rs:17:36: 17:40 (#0) }, neg: false)
@@ -175,7 +175,7 @@ body:
175175
body:
176176
Expr {
177177
ty: bool
178-
temp_lifetime: TempLifetime { temp_lifetime: Some(Node(18)), backwards_incompatible: None }
178+
temp_lifetime: TempLifetime { temp_lifetime: Some(Node(19)), backwards_incompatible: None }
179179
span: $DIR/thir-tree-match.rs:18:27: 18:32 (#0)
180180
kind:
181181
Scope {
@@ -184,7 +184,7 @@ body:
184184
value:
185185
Expr {
186186
ty: bool
187-
temp_lifetime: TempLifetime { temp_lifetime: Some(Node(18)), backwards_incompatible: None }
187+
temp_lifetime: TempLifetime { temp_lifetime: Some(Node(19)), backwards_incompatible: None }
188188
span: $DIR/thir-tree-match.rs:18:27: 18:32 (#0)
189189
kind:
190190
Literal( lit: Spanned { node: Bool(false), span: $DIR/thir-tree-match.rs:18:27: 18:32 (#0) }, neg: false)
@@ -219,7 +219,7 @@ body:
219219
body:
220220
Expr {
221221
ty: bool
222-
temp_lifetime: TempLifetime { temp_lifetime: Some(Node(23)), backwards_incompatible: None }
222+
temp_lifetime: TempLifetime { temp_lifetime: Some(Node(24)), backwards_incompatible: None }
223223
span: $DIR/thir-tree-match.rs:19:24: 19:28 (#0)
224224
kind:
225225
Scope {
@@ -228,7 +228,7 @@ body:
228228
value:
229229
Expr {
230230
ty: bool
231-
temp_lifetime: TempLifetime { temp_lifetime: Some(Node(23)), backwards_incompatible: None }
231+
temp_lifetime: TempLifetime { temp_lifetime: Some(Node(24)), backwards_incompatible: None }
232232
span: $DIR/thir-tree-match.rs:19:24: 19:28 (#0)
233233
kind:
234234
Literal( lit: Spanned { node: Bool(true), span: $DIR/thir-tree-match.rs:19:24: 19:28 (#0) }, neg: false)

0 commit comments

Comments
 (0)