Skip to content

Commit

Permalink
style(imports): group imports
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewsonin committed May 22, 2024
1 parent 8ac228e commit 0c87ed8
Show file tree
Hide file tree
Showing 9 changed files with 48 additions and 63 deletions.
22 changes: 10 additions & 12 deletions src/collections/blazemap.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
pub use crate::collections::blazemap::{
entries::{Entry, OccupiedEntry, VacantEntry},
iters::{Drain, IntoIter, IntoKeys, IntoValues, Iter, IterMut, Keys, Values, ValuesMut},
};
use crate::{
collections::blazemap::entries::VacantEntryInner,
traits::{
BlazeMapId, BlazeMapIdStatic, CapacityInfoProvider, KeyByOffsetProvider, TypeInfoContainer,
},
};
use std::{
borrow::Borrow,
fmt::{Debug, Formatter},
marker::PhantomData,
};

#[cfg(feature = "serde")]
use {
crate::prelude::BlazeMapIdWrapper,
Expand All @@ -14,17 +23,6 @@ use {
},
};

pub use crate::collections::blazemap::{
entries::{Entry, OccupiedEntry, VacantEntry},
iters::{Drain, IntoIter, IntoKeys, IntoValues, Iter, IterMut, Keys, Values, ValuesMut},
};
use crate::{
collections::blazemap::entries::VacantEntryInner,
traits::{
BlazeMapId, BlazeMapIdStatic, CapacityInfoProvider, KeyByOffsetProvider, TypeInfoContainer,
},
};

mod entries;
mod iters;

Expand Down
11 changes: 5 additions & 6 deletions src/collections/blazemap/iters.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
use crate::{
collections::blazemap::BlazeMap,
prelude::{BlazeMapId, BlazeMapIdStatic},
traits::{KeyByOffsetProvider, TypeInfoContainer},
};
use std::{
borrow::Borrow,
fmt::{Debug, Formatter},
marker::PhantomData,
panic::{RefUnwindSafe, UnwindSafe},
};

use crate::{
collections::blazemap::BlazeMap,
prelude::{BlazeMapId, BlazeMapIdStatic},
traits::{KeyByOffsetProvider, TypeInfoContainer},
};

/// An iterator over the entries of a [`BlazeMap`].
///
/// This `struct` is created by the [`iter`] method on [`BlazeMap`]. See its
Expand Down
10 changes: 5 additions & 5 deletions src/loom.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use std::{cmp::Ordering, marker::PhantomData};

use crate::prelude::AllInstancesIter;
use crate::{
prelude::AllInstancesIter,
traits::{BlazeMapId, TypeInfoContainer},
};
#[cfg(feature = "serde")]
use serde::{Serialize, Serializer};

use crate::traits::{BlazeMapId, TypeInfoContainer};
use std::{cmp::Ordering, marker::PhantomData};

/// Provides `PartialOrd`, `Ord` and `Serialize` traits, which are derived as
/// for an original type, for [`BlazeMapId`]s in the
Expand Down
16 changes: 7 additions & 9 deletions src/type_info_containers/key_wrapper.rs
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
use crate::{
prelude::BlazeMapId,
sync::RwLock,
traits::{CapacityInfoProvider, KeyByOffsetProvider, TypeInfoContainer, WrapKey},
};
#[cfg(not(feature = "loom"))]
use once_cell::sync::Lazy;
use std::{
borrow::Borrow,
collections::{hash_map::Entry, HashMap},
hash::Hash,
ops::Deref,
};

#[cfg(not(feature = "loom"))]
use once_cell::sync::Lazy;

use crate::{
prelude::BlazeMapId,
sync::RwLock,
traits::{CapacityInfoProvider, KeyByOffsetProvider, TypeInfoContainer, WrapKey},
};

/// Global, statically initialized container with correspondence mapping
/// between blazemap offset wrappers and original keys.
#[cfg(not(feature = "loom"))]
Expand Down
21 changes: 9 additions & 12 deletions src/type_info_containers/key_wrapper_bounded.rs
Original file line number Diff line number Diff line change
@@ -1,25 +1,22 @@
#[cfg(feature = "loom")]
use crate::sync::RwLockReadGuard;
use crate::{
prelude::BlazeMapId,
sync::{AtomicUsize, Ordering, RwLock},
traits::{CapacityInfoProvider, KeyByOffsetProvider, TypeInfoContainer, WrapKey},
};
use std::{
borrow::Borrow,
collections::{hash_map::Entry, HashMap},
hash::Hash,
ops::Deref,
};

use std::{borrow::Borrow, ops::Deref};
#[cfg(not(feature = "loom"))]
use std::{
cell::UnsafeCell,
mem::{needs_drop, MaybeUninit},
};

use crate::sync::{AtomicUsize, Ordering, RwLock};

use crate::{
prelude::BlazeMapId,
traits::{CapacityInfoProvider, KeyByOffsetProvider, TypeInfoContainer, WrapKey},
};

#[cfg(feature = "loom")]
use crate::sync::RwLockReadGuard;

/// Global, statically initialized container with correspondence mapping
/// between blazemap index wrappers and original keys.
///
Expand Down
7 changes: 4 additions & 3 deletions src/type_info_containers/plain_id.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
use crate::sync::{AtomicUsize, Ordering};
use crate::{
sync::{AtomicUsize, Ordering},
traits::{CapacityInfoProvider, KeyByOffsetProvider, TypeInfoContainer},
};
use std::{borrow::Borrow, ops::Deref};

use crate::traits::{CapacityInfoProvider, KeyByOffsetProvider, TypeInfoContainer};

/// Global, statically initialized offset generator.
#[doc(hidden)]
#[derive(Debug)]
Expand Down
9 changes: 3 additions & 6 deletions tests/loom.rs
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
#![cfg(loom)]

use blazemap::sync::RwLock;
use loom::sync::Arc;
use std::string::ToString;

use loom::thread;

use blazemap::{
define_key_wrapper, define_key_wrapper_bounded, define_plain_id,
loom::TestableId,
prelude::BlazeMapIdWrapper,
sync::RwLock,
traits::{CapacityInfoProvider, TypeInfoContainer},
};
use loom::{sync::Arc, thread};
use std::string::ToString;

fn run_model<F>(f: F)
where
Expand Down
9 changes: 3 additions & 6 deletions tests/miri.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
#![cfg(all(not(loom), feature = "serde"))]

use std::io::Write;

use rand::{prelude::StdRng, random, Rng, SeedableRng};

use blazemap::{define_key_wrapper, define_key_wrapper_bounded, prelude::BlazeMap};

use crate::random_action::{ActionPeekWeights, EventWeights};
use blazemap::{define_key_wrapper, define_key_wrapper_bounded, prelude::BlazeMap};
use rand::{prelude::StdRng, random, Rng, SeedableRng};
use std::io::Write;

mod random_action;

Expand Down
6 changes: 2 additions & 4 deletions tests/random_action.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,12 @@
#![allow(clippy::module_name_repetitions)]
#![allow(clippy::drop_non_drop)]

use std::fmt::{Debug, Formatter, Write};

use rand::Rng;

use blazemap::{
prelude::BlazeMap,
traits::{BlazeMapId, BlazeMapIdStatic},
};
use rand::Rng;
use std::fmt::{Debug, Formatter, Write};

#[derive(Debug)]
pub enum Action<K, V: Clone> {
Expand Down

0 comments on commit 0c87ed8

Please sign in to comment.