From 95a0f62e8f52dc4f85921132588bfba7be18caf2 Mon Sep 17 00:00:00 2001 From: Simonas Kazlauskas Date: Mon, 7 Nov 2022 00:39:08 +0200 Subject: [PATCH] Placate clippy --- src/os/unix/mod.rs | 4 +--- src/os/windows/mod.rs | 6 ++---- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/src/os/unix/mod.rs b/src/os/unix/mod.rs index fd0777eab..df7efdad5 100644 --- a/src/os/unix/mod.rs +++ b/src/os/unix/mod.rs @@ -365,9 +365,7 @@ pub struct Symbol { impl Symbol { /// Convert the loaded `Symbol` into a raw pointer. pub fn into_raw(self) -> *mut raw::c_void { - let pointer = self.pointer; - mem::forget(self); - pointer + self.pointer } } diff --git a/src/os/windows/mod.rs b/src/os/windows/mod.rs index eadeb6980..e3da940a2 100644 --- a/src/os/windows/mod.rs +++ b/src/os/windows/mod.rs @@ -307,7 +307,7 @@ impl fmt::Debug for Library { let mut buf = mem::MaybeUninit::<[mem::MaybeUninit::; 1024]>::uninit().assume_init(); let len = libloaderapi::GetModuleFileNameW(self.0, - (&mut buf[..]).as_mut_ptr().cast(), 1024) as usize; + buf[..].as_mut_ptr().cast(), 1024) as usize; if len == 0 { f.write_str(&format!("Library@{:p}", self.0)) } else { @@ -333,9 +333,7 @@ pub struct Symbol { impl Symbol { /// Convert the loaded `Symbol` into a handle. pub fn into_raw(self) -> FARPROC { - let pointer = self.pointer; - mem::forget(self); - pointer + self.pointer } }