Auto-generate lint documentation.
This commit is contained in:
parent
a055c5a1bd
commit
45c1e0ae07
22 changed files with 3914 additions and 1567 deletions
|
@ -7,6 +7,31 @@ use rustc_session::lint::FutureIncompatibleInfo;
|
|||
use rustc_span::symbol::sym;
|
||||
|
||||
declare_lint! {
|
||||
/// The `array_into_iter` lint detects calling `into_iter` on arrays.
|
||||
///
|
||||
/// ### Example
|
||||
///
|
||||
/// ```rust
|
||||
/// # #![allow(unused)]
|
||||
/// [1, 2, 3].into_iter().for_each(|n| { *n; });
|
||||
/// ```
|
||||
///
|
||||
/// {{produces}}
|
||||
///
|
||||
/// ### Explanation
|
||||
///
|
||||
/// In the future, it is planned to add an `IntoIter` implementation for
|
||||
/// arrays such that it will iterate over *values* of the array instead of
|
||||
/// references. Due to how method resolution works, this will change
|
||||
/// existing code that uses `into_iter` on arrays. The solution to avoid
|
||||
/// this warning is to use `iter()` instead of `into_iter()`.
|
||||
///
|
||||
/// This is a [future-incompatible] lint to transition this to a hard error
|
||||
/// in the future. See [issue #66145] for more details and a more thorough
|
||||
/// description of the lint.
|
||||
///
|
||||
/// [issue #66145]: https://github.com/rust-lang/rust/issues/66145
|
||||
/// [future-incompatible]: ../index.md#future-incompatible-lints
|
||||
pub ARRAY_INTO_ITER,
|
||||
Warn,
|
||||
"detects calling `into_iter` on arrays",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue