Skip to content

Commit

Permalink
Auto merge of rust-lang#7482 - xFrednet:7306-document-repeat-once-fp,…
Browse files Browse the repository at this point in the history
… 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 🙃
  • Loading branch information
bors committed Jul 24, 2021
2 parents 6103814 + 544c462 commit ea69a9d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion clippy_lints/src/repeat_once.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ declare_clippy_lint! {
/// - `.clone()` for `String`
/// - `.to_vec()` for `slice`
///
/// **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.
/// The lint will evaluate constant expressions and values as arguments of `.repeat(..)` and emit a message if
/// they are equivalent to `1`. (Related discussion in [rust-clippy#7306](https://github.com/rust-lang/rust-clippy/issues/7306))
///
/// **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.
///
/// **Known problems:** None.
///
Expand Down

0 comments on commit ea69a9d

Please sign in to comment.