Skip to content

Commit

Permalink
Fix nightly clippy lints
Browse files Browse the repository at this point in the history
  • Loading branch information
HadrienG2 committed Oct 6, 2024
1 parent 46719f9 commit d3a6d14
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 28 deletions.
2 changes: 1 addition & 1 deletion src/bitmap/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1492,7 +1492,7 @@ impl<B: Borrow<Bitmap>> Iterator for Iter<B> {
//
impl<B: Borrow<Bitmap>> FusedIterator for Iter<B> {}
//
impl<'bitmap> IntoIterator for &'bitmap Bitmap {
impl IntoIterator for &Bitmap {
type Item = BitmapIndex;
type IntoIter = Iter<Self>;

Expand Down
4 changes: 2 additions & 2 deletions src/bitmap/reference.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ impl<'target, Target: OwnedBitmap> BitmapRef<'target, Target> {
}
}

impl<'target, Target: OwnedBitmap> AsRef<Target> for BitmapRef<'target, Target> {
impl<Target: OwnedBitmap> AsRef<Target> for BitmapRef<'_, Target> {
fn as_ref(&self) -> &Target {
// SAFETY: - Both Target and BitmapRef are effectively repr(transparent)
// newtypes of NonNull<hwloc_bitmap_s>, so &Target and &BitmapRef are
Expand Down Expand Up @@ -230,7 +230,7 @@ impl<'target, Target: OwnedBitmap> From<&'target Target> for BitmapRef<'target,
}
}

impl<'target, Target: OwnedBitmap + Hash> Hash for BitmapRef<'target, Target> {
impl<Target: OwnedBitmap + Hash> Hash for BitmapRef<'_, Target> {
fn hash<H: hash::Hasher>(&self, state: &mut H) {
self.as_ref().hash(state)
}
Expand Down
34 changes: 9 additions & 25 deletions tests/single-threaded.rs
Original file line number Diff line number Diff line change
Expand Up @@ -601,11 +601,7 @@ fn post_bind_checks<Set: SpecializedBitmap, Res: Debug>(
set: &Set,
policy: MemoryBindingPolicy,
flags: MemoryBindingFlags,
try_get_final_binding: impl FnOnce(
&Res,
) -> Option<
Result<(Set, Option<MemoryBindingPolicy>), HybridError<MemoryBindingError<Set>>>,
>,
try_get_final_binding: impl FnOnce(&Res) -> FinalBinding<Set>,
) -> Result<Option<Res>, TestCaseError> {
// Handle some Windows edge cases
handle_windows_edge_cases!(&result, target, Ok(None));
Expand Down Expand Up @@ -705,6 +701,10 @@ fn post_bind_checks<Set: SpecializedBitmap, Res: Debug>(
Ok(Some(result))
}

/// Output of try_get_final_binding callbacks
type FinalBinding<Set> =
Option<Result<(Set, Option<MemoryBindingPolicy>), HybridError<MemoryBindingError<Set>>>>;

/// Test that hwloc's current process un-binding works
#[tracing::instrument(skip(topology))]
fn test_unbind_memory(topology: &Topology, flags: MemoryBindingFlags) -> Result<(), TestCaseError> {
Expand Down Expand Up @@ -766,11 +766,7 @@ fn post_unbind_checks(
target: MemoryBoundObject,
topology: &Topology,
flags: MemoryBindingFlags,
try_get_final_binding: impl FnOnce(
&(),
) -> Option<
Result<(NodeSet, Option<MemoryBindingPolicy>), HybridError<MemoryBindingError<NodeSet>>>,
>,
try_get_final_binding: impl FnOnce(&()) -> FinalBinding<NodeSet>,
) -> Result<(), TestCaseError> {
// Handle some Windows edge cases
handle_windows_edge_cases!(&result, target, Ok(()));
Expand Down Expand Up @@ -813,11 +809,7 @@ fn post_unbind_checks(
fn self_memory_binding_getter<Set: SpecializedBitmap>(
topology: &Topology,
flags: MemoryBindingFlags,
) -> impl FnOnce(
&(),
) -> Option<
Result<(Set, Option<MemoryBindingPolicy>), HybridError<MemoryBindingError<Set>>>,
> + '_ {
) -> impl FnOnce(&()) -> FinalBinding<Set> + '_ {
move |()| {
let membind_support = topology.feature_support().memory_binding()?;
let can_query_thisproc = membind_support.get_current_process();
Expand All @@ -839,11 +831,7 @@ fn self_memory_binding_getter<Set: SpecializedBitmap>(
fn process_memory_binding_getter<Set: SpecializedBitmap>(
topology: &Topology,
pid: ProcessId,
) -> impl FnOnce(
&(),
) -> Option<
Result<(Set, Option<MemoryBindingPolicy>), HybridError<MemoryBindingError<Set>>>,
> + '_ {
) -> impl FnOnce(&()) -> FinalBinding<Set> + '_ {
move |()| {
(topology.supports(
FeatureSupport::memory_binding,
Expand All @@ -858,11 +846,7 @@ fn process_memory_binding_getter<Set: SpecializedBitmap>(
fn area_memory_binding_getter<'out, Set: SpecializedBitmap, Res>(
topology: &'out Topology,
bytes: &'out [u8],
) -> impl FnOnce(
&Res,
) -> Option<
Result<(Set, Option<MemoryBindingPolicy>), HybridError<MemoryBindingError<Set>>>,
> + 'out {
) -> impl FnOnce(&Res) -> FinalBinding<Set> + 'out {
move |_| {
(topology.supports(
FeatureSupport::memory_binding,
Expand Down

0 comments on commit d3a6d14

Please sign in to comment.