-
Notifications
You must be signed in to change notification settings - Fork 26
Open
Description
Summary
When using an AllocRingBuffer from the crate and performing a check with len() == 0, Clippy does not recognize it as an optimization opportunity and does not provide a warning or suggestion. This behavior is inconsistent compared to how Clippy handles standard arrays.
Example
use ringbuffer::{AllocRingBuffer, RingBuffer};
fn main() {
let buffer: AllocRingBuffer<u32> = AllocRingBuffer::new(5);
if buffer.len() == 0 {
println!("Clippy should warn here.");
}
let array = [0, 10, 100];
if array.len() == 0 {
println!("Clippy does warn here.");
}
}To reproduce this, run cargo clippy or cargo +nightly clippy and observe that no warning is triggered for AllocRingBuffer, whereas it works correctly for standard arrays.
Metadata
Metadata
Assignees
Labels
No labels