Remove and fix useless drop of reference

This commit is contained in:
Urgau 2023-03-26 16:18:30 +02:00
parent f7b831ac8a
commit d36e390d81
5 changed files with 7 additions and 6 deletions

View File

@ -828,7 +828,7 @@ fn tys(&mut self, a: Ty<'tcx>, _: Ty<'tcx>) -> RelateResult<'tcx, Ty<'tcx>> {
} else { } else {
match variables.probe(vid) { match variables.probe(vid) {
TypeVariableValue::Known { value: u } => { TypeVariableValue::Known { value: u } => {
drop(variables); drop(inner);
self.relate(u, u) self.relate(u, u)
} }
TypeVariableValue::Unknown { universe: _universe } => { TypeVariableValue::Unknown { universe: _universe } => {

View File

@ -880,12 +880,11 @@ fn super_constant(
) { ) {
let Constant { let Constant {
span, span,
user_ty, user_ty: _, // no visit method for this
literal, literal,
} = constant; } = constant;
self.visit_span($(& $mutability)? *span); self.visit_span($(& $mutability)? *span);
drop(user_ty); // no visit method for this
match literal { match literal {
ConstantKind::Ty(ct) => self.visit_ty_const($(&$mutability)? *ct, location), ConstantKind::Ty(ct) => self.visit_ty_const($(&$mutability)? *ct, location),
ConstantKind::Val(_, ty) => self.visit_ty($(& $mutability)? *ty, TyContext::Location(location)), ConstantKind::Val(_, ty) => self.visit_ty($(& $mutability)? *ty, TyContext::Location(location)),

View File

@ -207,7 +207,7 @@ pub fn notify_one<T>(
let mut entry_guard = entry.lock(); let mut entry_guard = entry.lock();
let tcs = entry_guard.tcs; let tcs = entry_guard.tcs;
entry_guard.wake = true; entry_guard.wake = true;
drop(entry); drop(entry_guard);
Ok(WaitGuard { mutex_guard: Some(guard), notified_tcs: NotifiedTcs::Single(tcs) }) Ok(WaitGuard { mutex_guard: Some(guard), notified_tcs: NotifiedTcs::Single(tcs) })
} else { } else {
Err(guard) Err(guard)

View File

@ -1210,7 +1210,7 @@ pub fn set_times(&self, times: FileTimes) -> io::Result<()> {
// Redox doesn't appear to support `UTIME_OMIT`. // Redox doesn't appear to support `UTIME_OMIT`.
// ESP-IDF and HorizonOS do not support `futimens` at all and the behavior for those OS is therefore // ESP-IDF and HorizonOS do not support `futimens` at all and the behavior for those OS is therefore
// the same as for Redox. // the same as for Redox.
drop(times); let _ = times;
Err(io::const_io_error!( Err(io::const_io_error!(
io::ErrorKind::Unsupported, io::ErrorKind::Unsupported,
"setting file times not supported", "setting file times not supported",

View File

@ -375,7 +375,9 @@ fn test_scoped_threads_nll() {
// this is mostly a *compilation test* for this exact function: // this is mostly a *compilation test* for this exact function:
fn foo(x: &u8) { fn foo(x: &u8) {
thread::scope(|s| { thread::scope(|s| {
s.spawn(|| drop(x)); s.spawn(|| match x {
_ => (),
});
}); });
} }
// let's also run it for good measure // let's also run it for good measure