Skip to content

Commit ea69a9d

Browse files
committed
Auto merge of rust-lang#7482 - xFrednet:7306-document-repeat-once-fp, r=giraffate
Documented constant expression evaluation for `repeat_once` Documents the fact that the `repeat_once` lint evaluates constant expressions --- closes: rust-lang#7306 changelog: none (I don't think it's worth a change log entry, as nothing has really changed) r? `@giraffate` as you've implemented the lint and were part of the discussion in the issue 🙃
2 parents 6103814 + 544c462 commit ea69a9d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

clippy_lints/src/repeat_once.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,11 @@ declare_clippy_lint! {
1616
/// - `.clone()` for `String`
1717
/// - `.to_vec()` for `slice`
1818
///
19-
/// **Why is this bad?** For example, `String.repeat(1)` is equivalent to `.clone()`. If cloning the string is the intention behind this, `clone()` should be used.
19+
/// The lint will evaluate constant expressions and values as arguments of `.repeat(..)` and emit a message if
20+
/// they are equivalent to `1`. (Related discussion in [rust-clippy#7306](https://github.com/rust-lang/rust-clippy/issues/7306))
21+
///
22+
/// **Why is this bad?** For example, `String.repeat(1)` is equivalent to `.clone()`. If cloning
23+
/// the string is the intention behind this, `clone()` should be used.
2024
///
2125
/// **Known problems:** None.
2226
///

0 commit comments

Comments
 (0)