Add lint against Iterator::map
receiving a callable that returns ()
This commit is contained in:
parent
8b1dbf728a
commit
a914f37409
6 changed files with 134 additions and 1 deletions
|
@ -278,6 +278,7 @@
|
|||
//!
|
||||
//! ```
|
||||
//! # #![allow(unused_must_use)]
|
||||
//! # #![cfg_attr(not(bootstrap), allow(map_unit_fn))]
|
||||
//! let v = vec![1, 2, 3, 4, 5];
|
||||
//! v.iter().map(|x| println!("{x}"));
|
||||
//! ```
|
||||
|
|
|
@ -777,6 +777,7 @@ pub trait Iterator {
|
|||
/// println!("{x}");
|
||||
/// }
|
||||
/// ```
|
||||
#[rustc_diagnostic_item = "IteratorMap"]
|
||||
#[inline]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
fn map<B, F>(self, f: F) -> Map<Self, F>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue