You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: clippy_lints/src/repeat_once.rs
+5-1Lines changed: 5 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -16,7 +16,11 @@ declare_clippy_lint! {
16
16
/// - `.clone()` for `String`
17
17
/// - `.to_vec()` for `slice`
18
18
///
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.
0 commit comments