mention restriction to exported types as a limitation
This commit is contained in:
parent
3c501e4e41
commit
45f94c7598
@ -19,6 +19,11 @@
|
|||||||
/// It's not bad, but having them is idiomatic and allows the type to be used in for loops directly
|
/// It's not bad, but having them is idiomatic and allows the type to be used in for loops directly
|
||||||
/// (`for val in &iter {}`), without having to first call `iter()` or `iter_mut()`.
|
/// (`for val in &iter {}`), without having to first call `iter()` or `iter_mut()`.
|
||||||
///
|
///
|
||||||
|
/// ### Limitations
|
||||||
|
/// This lint is restricted to exported types only, because it is aimed at guiding towards an
|
||||||
|
/// idiomatic, _public_ API.
|
||||||
|
/// Implementing the `IntoIterator` trait when it is not needed or used anywhere doesn't help or improve the code.
|
||||||
|
///
|
||||||
/// ### Example
|
/// ### Example
|
||||||
/// ```rust
|
/// ```rust
|
||||||
/// struct MySlice<'a>(&'a [u8]);
|
/// struct MySlice<'a>(&'a [u8]);
|
||||||
@ -61,6 +66,12 @@
|
|||||||
/// by just calling `.iter()`, instead of the more awkward `<&Type>::into_iter` or `(&val).into_iter()` syntax
|
/// by just calling `.iter()`, instead of the more awkward `<&Type>::into_iter` or `(&val).into_iter()` syntax
|
||||||
/// in case of ambiguity with another `IntoIterator` impl.
|
/// in case of ambiguity with another `IntoIterator` impl.
|
||||||
///
|
///
|
||||||
|
/// ### Limitations
|
||||||
|
/// This lint is restricted to exported types only, because it is aimed at guiding towards an
|
||||||
|
/// idiomatic, _public_ API.
|
||||||
|
/// Adding an `iter` or `iter_mut` for private types when it is not needed or used doesn't improve code,
|
||||||
|
/// and in fact, is linted against by the `dead_code` lint.
|
||||||
|
///
|
||||||
/// ### Example
|
/// ### Example
|
||||||
/// ```rust
|
/// ```rust
|
||||||
/// struct MySlice<'a>(&'a [u8]);
|
/// struct MySlice<'a>(&'a [u8]);
|
||||||
|
Loading…
Reference in New Issue
Block a user