about summary refs log tree commit diff
path: root/library/core/src
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2023-02-26 00:46:25 +0100
committerGitHub <noreply@github.com>2023-02-26 00:46:25 +0100
commitfa10a21bd26cf5031c0ca878587839b9296629eb (patch)
treec26170f0b46427d20f17498138be36d27f179ff9 /library/core/src
parentf840799385961b3e047a43af3f44b299f16277df (diff)
parent99344a8b3231925bc52190b7e9c18a597c54ca90 (diff)
downloadrust-fa10a21bd26cf5031c0ca878587839b9296629eb.tar.gz
rust-fa10a21bd26cf5031c0ca878587839b9296629eb.zip
Rollup merge of #107890 - obeis:mapping-to-unit, r=cjgillot
Lint against `Iterator::map` receiving a callable that returns `()`

Close #106991
Diffstat (limited to 'library/core/src')
-rw-r--r--library/core/src/iter/mod.rs1
-rw-r--r--library/core/src/iter/traits/iterator.rs1
2 files changed, 2 insertions, 0 deletions
diff --git a/library/core/src/iter/mod.rs b/library/core/src/iter/mod.rs
index 156b925de77..ae00232c12c 100644
--- a/library/core/src/iter/mod.rs
+++ b/library/core/src/iter/mod.rs
@@ -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}"));
 //! ```
diff --git a/library/core/src/iter/traits/iterator.rs b/library/core/src/iter/traits/iterator.rs
index b3a630d9559..b8e7d0a68da 100644
--- a/library/core/src/iter/traits/iterator.rs
+++ b/library/core/src/iter/traits/iterator.rs
@@ -789,6 +789,7 @@ pub trait Iterator {
     ///     println!("{x}");
     /// }
     /// ```
+    #[rustc_diagnostic_item = "IteratorMap"]
     #[inline]
     #[stable(feature = "rust1", since = "1.0.0")]
     #[rustc_do_not_const_check]