Skip to content

Commit 61a73bb

Browse files
committed
some small doc improvements
1 parent 5622f9a commit 61a73bb

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

clippy_lints/src/len_zero.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,10 @@ use utils::{get_item_name, in_macro, snippet, span_lint, span_lint_and_sugg, wal
1010
/// just to compare to zero, and suggests using `.is_empty()` where applicable.
1111
///
1212
/// **Why is this bad?** Some structures can answer `.is_empty()` much faster
13-
/// than calculating their length. So it is good to get into the habit of using
14-
/// `.is_empty()`, and having it is cheap. Besides, it makes the intent clearer
15-
/// than a comparison.
13+
/// than calculating their length. Notably, for slices, getting the length
14+
/// requires a subtraction whereas `.is_empty()` is just a comparison. So it is
15+
/// good to get into the habit of using `.is_empty()`, and having it is cheap.
16+
/// Besides, it makes the intent clearer than a manual comparison.
1617
///
1718
/// **Known problems:** None.
1819
///

clippy_lints/src/returns.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ use utils::{span_note_and_lint, span_lint_and_then, snippet_opt, match_path_ast,
1010
/// **Why is this bad?** Removing the `return` and semicolon will make the code
1111
/// more rusty.
1212
///
13-
/// **Known problems:** None.
13+
/// **Known problems:** If the computation returning the value borrows a local
14+
/// variable, removing the `return` may run afoul of the borrow checker.
1415
///
1516
/// **Example:**
1617
/// ```rust

0 commit comments

Comments
 (0)