about summary refs log tree commit diff
path: root/compiler/rustc_data_structures/src/sync
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-07-29 02:43:41 +0000
committerbors <bors@rust-lang.org>2024-07-29 02:43:41 +0000
commit2e630267b2bce50af3258ce4817e377fa09c145b (patch)
tree29006db815bf547dfd0129910b23b8c54675bd98 /compiler/rustc_data_structures/src/sync
parent2cbbe8b8bb2be672b14cf741a2f0ec24a49f3f0b (diff)
parent84ac80f1921afc243d71fd0caaa4f2838c294102 (diff)
downloadrust-2e630267b2bce50af3258ce4817e377fa09c145b.tar.gz
rust-2e630267b2bce50af3258ce4817e377fa09c145b.zip
Auto merge of #125443 - nnethercote:rustfmt-use-decls, r=lcnr,cuviper,GuillaumeGomez
rustfmt `use` declarations

This PR implements https://github.com/rust-lang/compiler-team/issues/750, which changes how `use` declarations are formatted by adding these options to `rustfmt.toml`:
```
group_imports = "StdExternalCrate"
imports_granularity = "Module"
```

r? `@ghost`
Diffstat (limited to 'compiler/rustc_data_structures/src/sync')
-rw-r--r--compiler/rustc_data_structures/src/sync/freeze.rs15
-rw-r--r--compiler/rustc_data_structures/src/sync/lock.rs21
-rw-r--r--compiler/rustc_data_structures/src/sync/parallel.rs7
-rw-r--r--compiler/rustc_data_structures/src/sync/worker_local.rs5
4 files changed, 24 insertions, 24 deletions
diff --git a/compiler/rustc_data_structures/src/sync/freeze.rs b/compiler/rustc_data_structures/src/sync/freeze.rs
index 466c44f59bb..fad5f583d1c 100644
--- a/compiler/rustc_data_structures/src/sync/freeze.rs
+++ b/compiler/rustc_data_structures/src/sync/freeze.rs
@@ -1,14 +1,13 @@
+use std::cell::UnsafeCell;
+use std::intrinsics::likely;
+use std::marker::PhantomData;
+use std::ops::{Deref, DerefMut};
+use std::ptr::NonNull;
+use std::sync::atomic::Ordering;
+
 use crate::sync::{AtomicBool, ReadGuard, RwLock, WriteGuard};
 #[cfg(parallel_compiler)]
 use crate::sync::{DynSend, DynSync};
-use std::{
-    cell::UnsafeCell,
-    intrinsics::likely,
-    marker::PhantomData,
-    ops::{Deref, DerefMut},
-    ptr::NonNull,
-    sync::atomic::Ordering,
-};
 
 /// A type which allows mutation using a lock until
 /// the value is frozen and can be accessed lock-free.
diff --git a/compiler/rustc_data_structures/src/sync/lock.rs b/compiler/rustc_data_structures/src/sync/lock.rs
index 780be773945..7cf942685e3 100644
--- a/compiler/rustc_data_structures/src/sync/lock.rs
+++ b/compiler/rustc_data_structures/src/sync/lock.rs
@@ -19,19 +19,20 @@ pub enum Mode {
 }
 
 mod maybe_sync {
-    use super::Mode;
-    use crate::sync::mode;
-    #[cfg(parallel_compiler)]
-    use crate::sync::{DynSend, DynSync};
-    use parking_lot::lock_api::RawMutex as _;
-    use parking_lot::RawMutex;
-    use std::cell::Cell;
-    use std::cell::UnsafeCell;
+    use std::cell::{Cell, UnsafeCell};
     use std::intrinsics::unlikely;
     use std::marker::PhantomData;
     use std::mem::ManuallyDrop;
     use std::ops::{Deref, DerefMut};
 
+    use parking_lot::lock_api::RawMutex as _;
+    use parking_lot::RawMutex;
+
+    use super::Mode;
+    use crate::sync::mode;
+    #[cfg(parallel_compiler)]
+    use crate::sync::{DynSend, DynSync};
+
     /// A guard holding mutable access to a `Lock` which is in a locked state.
     #[must_use = "if unused the Lock will immediately unlock"]
     pub struct LockGuard<'a, T> {
@@ -186,12 +187,12 @@ mod maybe_sync {
 }
 
 mod no_sync {
-    use super::Mode;
     use std::cell::RefCell;
-
     #[doc(no_inline)]
     pub use std::cell::RefMut as LockGuard;
 
+    use super::Mode;
+
     pub struct Lock<T>(RefCell<T>);
 
     impl<T> Lock<T> {
diff --git a/compiler/rustc_data_structures/src/sync/parallel.rs b/compiler/rustc_data_structures/src/sync/parallel.rs
index 7783de57fba..2b89431c2ed 100644
--- a/compiler/rustc_data_structures/src/sync/parallel.rs
+++ b/compiler/rustc_data_structures/src/sync/parallel.rs
@@ -3,9 +3,6 @@
 
 #![allow(dead_code)]
 
-use crate::sync::IntoDynSyncSend;
-use crate::FatalErrorMarker;
-use parking_lot::Mutex;
 use std::any::Any;
 use std::panic::{catch_unwind, resume_unwind, AssertUnwindSafe};
 
@@ -13,6 +10,10 @@ use std::panic::{catch_unwind, resume_unwind, AssertUnwindSafe};
 pub use disabled::*;
 #[cfg(parallel_compiler)]
 pub use enabled::*;
+use parking_lot::Mutex;
+
+use crate::sync::IntoDynSyncSend;
+use crate::FatalErrorMarker;
 
 /// A guard used to hold panics that occur during a parallel section to later by unwound.
 /// This is used for the parallel compiler to prevent fatal errors from non-deterministically
diff --git a/compiler/rustc_data_structures/src/sync/worker_local.rs b/compiler/rustc_data_structures/src/sync/worker_local.rs
index 07a361ba260..4950481d311 100644
--- a/compiler/rustc_data_structures/src/sync/worker_local.rs
+++ b/compiler/rustc_data_structures/src/sync/worker_local.rs
@@ -1,11 +1,10 @@
-use parking_lot::Mutex;
-use std::cell::Cell;
-use std::cell::OnceCell;
+use std::cell::{Cell, OnceCell};
 use std::num::NonZero;
 use std::ops::Deref;
 use std::ptr;
 use std::sync::Arc;
 
+use parking_lot::Mutex;
 #[cfg(parallel_compiler)]
 use {crate::outline, crate::sync::CacheAligned};