You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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};fnmain(){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.
The text was updated successfully, but these errors were encountered:
Summary
When using an
AllocRingBuffer
from the crate and performing a check withlen() == 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
To reproduce this, run
cargo clippy
orcargo +nightly clippy
and observe that no warning is triggered forAllocRingBuffer
, whereas it works correctly for standard arrays.The text was updated successfully, but these errors were encountered: