Skip to content

Commit

Permalink
Merge pull request #219 from waywardmonkeys/use-semicolon
Browse files Browse the repository at this point in the history
clippy: Use semicolon when not returning a value.
  • Loading branch information
fitzgen committed Sep 25, 2023
2 parents d9ae7bb + ca48a7b commit 4ff9827
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
8 changes: 4 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,7 @@ impl Bump {
/// assert!(bump.try_alloc(5).is_err());
/// ```
pub fn set_allocation_limit(&self, limit: Option<usize>) {
self.allocation_limit.set(limit)
self.allocation_limit.set(limit);
}

/// How much headroom an arena has before it hits its allocation
Expand Down Expand Up @@ -854,7 +854,7 @@ impl Bump {
// directly into the heap instead. It seems we get it to realize
// this most consistently if we put this critical line into it's
// own function instead of inlining it into the surrounding code.
ptr::write(ptr, f())
ptr::write(ptr, f());
}

let layout = Layout::new::<T>();
Expand Down Expand Up @@ -906,7 +906,7 @@ impl Bump {
// directly into the heap instead. It seems we get it to realize
// this most consistently if we put this critical line into it's
// own function instead of inlining it into the surrounding code.
ptr::write(ptr, f())
ptr::write(ptr, f());
}

//SAFETY: Self-contained:
Expand Down Expand Up @@ -1848,7 +1848,7 @@ unsafe impl<'a> alloc::Alloc for &'a Bump {

#[inline]
unsafe fn dealloc(&mut self, ptr: NonNull<u8>, layout: Layout) {
Bump::dealloc(self, ptr, layout)
Bump::dealloc(self, ptr, layout);
}

#[inline]
Expand Down
16 changes: 8 additions & 8 deletions tests/try_alloc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,9 @@ fn main() {
GLOBAL_ALLOCATOR.set_returning_null(fail_alloc);

if fail_alloc {
assert_alloc_err(&bump)
assert_alloc_err(&bump);
} else {
assert_alloc_ok(&bump)
assert_alloc_ok(&bump);
}
}
}
Expand Down Expand Up @@ -169,7 +169,7 @@ fn main() {
test_static_size_alloc(
|bump| assert!(bump.try_alloc(1u8).is_ok()),
|bump| assert!(bump.try_alloc(1u8).is_err()),
)
);
},
),
test!(
Expand All @@ -178,7 +178,7 @@ fn main() {
test_static_size_alloc(
|bump| assert!(bump.try_alloc_with(|| 1u8).is_ok()),
|bump| assert!(bump.try_alloc_with(|| 1u8).is_err()),
)
);
},
),
test!(
Expand All @@ -187,7 +187,7 @@ fn main() {
test_static_size_alloc(
|bump| assert!(bump.try_alloc_try_with::<_, _, ()>(|| Ok(1u8)).is_ok()),
|bump| assert!(bump.try_alloc_try_with::<_, _, ()>(|| Ok(1u8)).is_err()),
)
);
},
),
test!(
Expand All @@ -198,15 +198,15 @@ fn main() {
assert!(matches!(
bump.try_alloc_try_with::<_, u8, _>(|| Err(())),
Err(AllocOrInitError::Init(_))
))
));
},
|bump| {
assert!(matches!(
bump.try_alloc_try_with::<_, u8, _>(|| Err(())),
Err(AllocOrInitError::Alloc(_))
))
));
},
)
);
},
),
#[cfg(feature = "collections")]
Expand Down

0 comments on commit 4ff9827

Please sign in to comment.