Skip to content

Commit d36e390

Browse files
committed
Remove and fix useless drop of reference
1 parent f7b831a commit d36e390

File tree

5 files changed

+7
-6
lines changed

5 files changed

+7
-6
lines changed

compiler/rustc_infer/src/infer/nll_relate/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -828,7 +828,7 @@ where
828828
} else {
829829
match variables.probe(vid) {
830830
TypeVariableValue::Known { value: u } => {
831-
drop(variables);
831+
drop(inner);
832832
self.relate(u, u)
833833
}
834834
TypeVariableValue::Unknown { universe: _universe } => {

compiler/rustc_middle/src/mir/visit.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -880,12 +880,11 @@ macro_rules! make_mir_visitor {
880880
) {
881881
let Constant {
882882
span,
883-
user_ty,
883+
user_ty: _, // no visit method for this
884884
literal,
885885
} = constant;
886886

887887
self.visit_span($(& $mutability)? *span);
888-
drop(user_ty); // no visit method for this
889888
match literal {
890889
ConstantKind::Ty(ct) => self.visit_ty_const($(&$mutability)? *ct, location),
891890
ConstantKind::Val(_, ty) => self.visit_ty($(& $mutability)? *ty, TyContext::Location(location)),

library/std/src/sys/sgx/waitqueue/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ impl WaitQueue {
207207
let mut entry_guard = entry.lock();
208208
let tcs = entry_guard.tcs;
209209
entry_guard.wake = true;
210-
drop(entry);
210+
drop(entry_guard);
211211
Ok(WaitGuard { mutex_guard: Some(guard), notified_tcs: NotifiedTcs::Single(tcs) })
212212
} else {
213213
Err(guard)

library/std/src/sys/unix/fs.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1210,7 +1210,7 @@ impl File {
12101210
// Redox doesn't appear to support `UTIME_OMIT`.
12111211
// ESP-IDF and HorizonOS do not support `futimens` at all and the behavior for those OS is therefore
12121212
// the same as for Redox.
1213-
drop(times);
1213+
let _ = times;
12141214
Err(io::const_io_error!(
12151215
io::ErrorKind::Unsupported,
12161216
"setting file times not supported",

library/std/src/thread/tests.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,9 @@ fn test_scoped_threads_nll() {
375375
// this is mostly a *compilation test* for this exact function:
376376
fn foo(x: &u8) {
377377
thread::scope(|s| {
378-
s.spawn(|| drop(x));
378+
s.spawn(|| match x {
379+
_ => (),
380+
});
379381
});
380382
}
381383
// let's also run it for good measure

0 commit comments

Comments
 (0)