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
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 🙃
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