summary refs log tree commit diff
path: root/library/coretests
diff options
context:
space:
mode:
authorMatthias Krüger <476013+matthiaskrgr@users.noreply.github.com>2025-05-17 10:33:09 +0200
committerGitHub <noreply@github.com>2025-05-17 10:33:09 +0200
commit642cd65ab256fe70e4e185def0816ab39077f5c6 (patch)
treea716b28d266a0e43fdcc6dcbda0cf5f8a384d999 /library/coretests
parent8c14588fbb5c2b410d0d169c41c851458e02048b (diff)
parentab1c49a7facad5083c20407a2b1fd0b2104e174e (diff)
downloadrust-642cd65ab256fe70e4e185def0816ab39077f5c6.tar.gz
rust-642cd65ab256fe70e4e185def0816ab39077f5c6.zip
Rollup merge of #140957 - JulianKnodt:array_must_use, r=Mark-Simulacrum
Add `#[must_use]` to Array::map

The output of Array::map is intended to be an array of the same size, and does not modify the original in place nor is it intended for side-effects. Thus, under normal circumstances it should be consumed.

See [discussion](https://internals.rust-lang.org/t/array-map-annotate-with-must-use/22813/26).

Attaching to tracking issue #75243
Diffstat (limited to 'library/coretests')
-rw-r--r--library/coretests/tests/array.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/library/coretests/tests/array.rs b/library/coretests/tests/array.rs
index b6d18f1ec38..30ccbbc3203 100644
--- a/library/coretests/tests/array.rs
+++ b/library/coretests/tests/array.rs
@@ -325,7 +325,7 @@ fn array_map_drop_safety() {
     let success = std::panic::catch_unwind(|| {
         let items = [0; 10];
         let mut nth = 0;
-        items.map(|_| {
+        let _ = items.map(|_| {
             assert!(nth < num_to_create);
             nth += 1;
             DropCounter