Skip to content

Commit 261bc4c

Browse files
authored
Rollup merge of #107890 - obeis:mapping-to-unit, r=cjgillot
Lint against `Iterator::map` receiving a callable that returns `()` Close #106991
2 parents 3fbe383 + 6111ea7 commit 261bc4c

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
@@ -789,6 +789,7 @@ pub trait Iterator {
789789
/// println!("{x}");
790790
/// }
791791
/// ```
792+
#[rustc_diagnostic_item = "IteratorMap"]
792793
#[inline]
793794
#[stable(feature = "rust1", since = "1.0.0")]
794795
#[rustc_do_not_const_check]

0 commit comments

Comments
 (0)