Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clippy: Use semicolon when not returning a value. #219

Merged
merged 1 commit into from
Sep 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -857,7 +857,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 @@ -910,7 +910,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 @@ -1862,7 +1862,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