3 ms·
From clippy’s docs: > Some structures can answer .is_empty() much faster than calculating their length. So it is good to get into the habit of using .is_empty(
by steveklabnik 5y ago
From clippy’s docs:
> Some structures can answer .is_empty() much faster than calculating their length. So it is good to get into the habit of using .is_empty(), and having it is cheap. Besides, it makes the intent clearer than a manual comparison in some contexts.
It also has a lint for implementing both methods if you’ve only defined one, to help perpetuate the convention.