Auto merge of #4954 - JohnTitor:improve-len-zero-doc, r=llogiq

Correct documentation for `len_zero`

Fixes #4902

changelog: none
This commit is contained in:
bors 2019-12-25 16:27:18 +00:00
commit 87e628f646

View File

@ -15,10 +15,9 @@ declare_clippy_lint! {
/// just to compare to zero, and suggests using `.is_empty()` where applicable.
///
/// **Why is this bad?** Some structures can answer `.is_empty()` much faster
/// than calculating their length. Notably, for slices, getting the length
/// requires a subtraction whereas `.is_empty()` is just a comparison. 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.
/// 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.
///
/// **Known problems:** None.
///