We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent ca0806c commit 95f32f1Copy full SHA for 95f32f1
src/libarena/lib.rs
@@ -310,13 +310,8 @@ impl Default for DroplessArena {
310
impl DroplessArena {
311
pub fn in_arena<T: ?Sized>(&self, ptr: *const T) -> bool {
312
let ptr = ptr as *const u8 as *mut u8;
313
- for chunk in &*self.chunks.borrow() {
314
- if chunk.start() <= ptr && ptr < chunk.end() {
315
- return true;
316
- }
317
318
319
- false
+ self.chunks.borrow().iter().any(|chunk| chunk.start() <= ptr && ptr < chunk.end())
320
}
321
322
fn align(&self, align: usize) {
@@ -408,7 +403,7 @@ impl DroplessArena {
408
403
{
409
404
assert!(!mem::needs_drop::<T>());
410
405
assert!(mem::size_of::<T>() != 0);
411
- assert!(slice.len() != 0);
406
+ assert!(!slice.is_empty());
412
407
413
let mem = self.alloc_raw(
414
slice.len() * mem::size_of::<T>(),
0 commit comments