From 61a73bb630d1f125b407e6d331fd0200ed6b9d30 Mon Sep 17 00:00:00 2001 From: Andre Bogus Date: Sun, 13 Aug 2017 00:14:28 +0200 Subject: [PATCH] some small doc improvements --- clippy_lints/src/len_zero.rs | 7 ++++--- clippy_lints/src/returns.rs | 3 ++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/clippy_lints/src/len_zero.rs b/clippy_lints/src/len_zero.rs index 3a88c53d61d8..9b76986dbcc2 100644 --- a/clippy_lints/src/len_zero.rs +++ b/clippy_lints/src/len_zero.rs @@ -10,9 +10,10 @@ use utils::{get_item_name, in_macro, snippet, span_lint, span_lint_and_sugg, wal /// 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. 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 comparison. +/// 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. /// /// **Known problems:** None. /// diff --git a/clippy_lints/src/returns.rs b/clippy_lints/src/returns.rs index acd60ba2f46d..41601a808903 100644 --- a/clippy_lints/src/returns.rs +++ b/clippy_lints/src/returns.rs @@ -10,7 +10,8 @@ use utils::{span_note_and_lint, span_lint_and_then, snippet_opt, match_path_ast, /// **Why is this bad?** Removing the `return` and semicolon will make the code /// more rusty. /// -/// **Known problems:** None. +/// **Known problems:** If the computation returning the value borrows a local +/// variable, removing the `return` may run afoul of the borrow checker. /// /// **Example:** /// ```rust