Skip to content

Commit 6111ea7

Browse files
committed
Add lint against Iterator::map receiving a callable that returns ()
1 parent 6acdb2d commit 6111ea7

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

core/src/iter/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,7 @@
278278
//!
279279
//! ```
280280
//! # #![allow(unused_must_use)]
281+
//! # #![cfg_attr(not(bootstrap), allow(map_unit_fn))]
281282
//! let v = vec![1, 2, 3, 4, 5];
282283
//! v.iter().map(|x| println!("{x}"));
283284
//! ```

core/src/iter/traits/iterator.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -777,6 +777,7 @@ pub trait Iterator {
777777
/// println!("{x}");
778778
/// }
779779
/// ```
780+
#[rustc_diagnostic_item = "IteratorMap"]
780781
#[inline]
781782
#[stable(feature = "rust1", since = "1.0.0")]
782783
fn map<B, F>(self, f: F) -> Map<Self, F>

0 commit comments

Comments
 (0)