]> git.lizzy.rs Git - rust.git/commitdiff
Move `use align_of` in atomic.rs into the places where it is used.
authorMara Bos <m-ou.se@m-ou.se>
Mon, 21 Sep 2020 18:44:45 +0000 (20:44 +0200)
committerMara Bos <m-ou.se@m-ou.se>
Mon, 21 Sep 2020 18:44:45 +0000 (20:44 +0200)
library/core/src/sync/atomic.rs

index fa9d3c95b1790ce477fe0dee6911abcf12b04e52..5c9cfe27101f07edbcfbbe669bf4074ec0385584 100644 (file)
 use crate::fmt;
 use crate::intrinsics;
 
-#[allow(unused_imports)]
-use crate::mem::align_of;
-
 use crate::hint::spin_loop;
 
 /// Signals the processor that it is inside a busy-wait spin-loop ("spin lock").
@@ -861,6 +858,7 @@ pub fn get_mut(&mut self) -> &mut *mut T {
     #[cfg(target_has_atomic_equal_alignment = "ptr")]
     #[unstable(feature = "atomic_from_mut", issue = "76314")]
     pub fn from_mut(v: &mut *mut T) -> &Self {
+        use crate::mem::align_of;
         let [] = [(); align_of::<AtomicPtr<()>>() - align_of::<*mut ()>()];
         // SAFETY:
         //  - the mutable reference guarantees unique ownership.
@@ -1311,6 +1309,7 @@ pub fn get_mut(&mut self) -> &mut $int_type {
                 #[$cfg_align]
                 #[unstable(feature = "atomic_from_mut", issue = "76314")]
                 pub fn from_mut(v: &mut $int_type) -> &Self {
+                    use crate::mem::align_of;
                     let [] = [(); align_of::<Self>() - align_of::<$int_type>()];
                     // SAFETY:
                     //  - the mutable reference guarantees unique ownership.