mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-24 13:43:17 +00:00
Auto merge of #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: #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 🙃
This commit is contained in:
commit
ea69a9d10a
1 changed files with 5 additions and 1 deletions
|
@ -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.
|
||||
///
|
||||
|
|
Loading…
Reference in a new issue