Skip to content

Commit 544c462

Browse files
committed
Documented constant expression evaluation for repeat_once
1 parent 6103814 commit 544c462

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)