about summary refs log tree commit diff
diff options
context:
space:
mode:
authorUrgau <urgau@numericable.fr>2023-03-27 19:29:50 +0200
committerUrgau <urgau@numericable.fr>2023-05-10 19:36:01 +0200
commit7dab6094bb5ca154e6642b9427cffb3370812409 (patch)
tree38840252de553175d0ea1c8682cda2d895a10016
parentd36e390d8176babedcf326581959958d447170cd (diff)
downloadrust-7dab6094bb5ca154e6642b9427cffb3370812409.tar.gz
rust-7dab6094bb5ca154e6642b9427cffb3370812409.zip
Remove useless drop of copy type
-rw-r--r--compiler/rustc_builtin_macros/src/format_foreign.rs4
-rw-r--r--library/core/src/task/poll.rs2
-rw-r--r--library/core/src/task/ready.rs4
-rw-r--r--library/std/src/panicking.rs2
4 files changed, 5 insertions, 7 deletions
diff --git a/compiler/rustc_builtin_macros/src/format_foreign.rs b/compiler/rustc_builtin_macros/src/format_foreign.rs
index bd9e903b6ba..bd5356575ca 100644
--- a/compiler/rustc_builtin_macros/src/format_foreign.rs
+++ b/compiler/rustc_builtin_macros/src/format_foreign.rs
@@ -562,15 +562,13 @@ pub(crate) mod printf {
         }
 
         if let Type = state {
-            drop(c);
             type_ = at.slice_between(next).unwrap();
 
             // Don't use `move_to!` here, as we *can* be at the end of the input.
             at = next;
         }
 
-        drop(c);
-        drop(next);
+        let _ = c; // to avoid never used value
 
         end = at;
         let position = InnerSpan::new(start.at, end.at);
diff --git a/library/core/src/task/poll.rs b/library/core/src/task/poll.rs
index 168516263f1..5283a576d1b 100644
--- a/library/core/src/task/poll.rs
+++ b/library/core/src/task/poll.rs
@@ -116,7 +116,7 @@ impl<T> Poll<T> {
     ///     let fut = Pin::new(&mut fut);
     ///
     ///     let num = fut.poll(cx).ready()?;
-    ///     # drop(num);
+    ///     # let _ = num; // to silence unused warning
     ///     // ... use num
     ///
     ///     Poll::Ready(())
diff --git a/library/core/src/task/ready.rs b/library/core/src/task/ready.rs
index b1daf545fbe..8d12625e88d 100644
--- a/library/core/src/task/ready.rs
+++ b/library/core/src/task/ready.rs
@@ -22,7 +22,7 @@ use core::task::Poll;
 ///     let fut = Pin::new(&mut fut);
 ///
 ///     let num = ready!(fut.poll(cx));
-///     # drop(num);
+///     # let _ = num;
 ///     // ... use num
 ///
 ///     Poll::Ready(())
@@ -44,7 +44,7 @@ use core::task::Poll;
 ///     Poll::Ready(t) => t,
 ///     Poll::Pending => return Poll::Pending,
 /// };
-///     # drop(num);
+///     # let _ = num; // to silence unused warning
 ///     # // ... use num
 ///     #
 ///     # Poll::Ready(())
diff --git a/library/std/src/panicking.rs b/library/std/src/panicking.rs
index a46a29cbad6..6d59266b6f8 100644
--- a/library/std/src/panicking.rs
+++ b/library/std/src/panicking.rs
@@ -541,7 +541,7 @@ pub fn begin_panic_handler(info: &PanicInfo<'_>) -> ! {
             // Lazily, the first time this gets called, run the actual string formatting.
             self.string.get_or_insert_with(|| {
                 let mut s = String::new();
-                drop(s.write_fmt(*inner));
+                let _err = s.write_fmt(*inner);
                 s
             })
         }