about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-03-26 20:17:04 +0000
committerbors <bors@rust-lang.org>2022-03-26 20:17:04 +0000
commit1d9c262eea411ec5230f8a4c9ba50b3647064da4 (patch)
tree15ea90727338050f236368fed6977ae837bce1cd /src/test
parent1fca19c8ca4ae5e71e8b17a82c3acfeb78c48891 (diff)
parent763094bb591235c9c02188aa7e43b6f876153c48 (diff)
downloadrust-1d9c262eea411ec5230f8a4c9ba50b3647064da4.tar.gz
rust-1d9c262eea411ec5230f8a4c9ba50b3647064da4.zip
Auto merge of #95274 - jendrikw:slice-must-use, r=Dylan-DPC
add #[must_use] to functions of slice and its iterators.

Continuation of #92853.

Tracking issue: #89692.
Diffstat (limited to 'src/test')
-rw-r--r--src/test/ui/iterators/into-iter-on-arrays-lint.fixed1
-rw-r--r--src/test/ui/iterators/into-iter-on-arrays-lint.rs1
-rw-r--r--src/test/ui/iterators/into-iter-on-arrays-lint.stderr24
3 files changed, 14 insertions, 12 deletions
diff --git a/src/test/ui/iterators/into-iter-on-arrays-lint.fixed b/src/test/ui/iterators/into-iter-on-arrays-lint.fixed
index 0055758a6a4..6e02a7024b9 100644
--- a/src/test/ui/iterators/into-iter-on-arrays-lint.fixed
+++ b/src/test/ui/iterators/into-iter-on-arrays-lint.fixed
@@ -2,6 +2,7 @@
 // run-rustfix
 // rustfix-only-machine-applicable
 
+#[allow(unused_must_use)]
 fn main() {
     let small = [1, 2];
     let big = [0u8; 33];
diff --git a/src/test/ui/iterators/into-iter-on-arrays-lint.rs b/src/test/ui/iterators/into-iter-on-arrays-lint.rs
index 01857c78a73..582d5cadd06 100644
--- a/src/test/ui/iterators/into-iter-on-arrays-lint.rs
+++ b/src/test/ui/iterators/into-iter-on-arrays-lint.rs
@@ -2,6 +2,7 @@
 // run-rustfix
 // rustfix-only-machine-applicable
 
+#[allow(unused_must_use)]
 fn main() {
     let small = [1, 2];
     let big = [0u8; 33];
diff --git a/src/test/ui/iterators/into-iter-on-arrays-lint.stderr b/src/test/ui/iterators/into-iter-on-arrays-lint.stderr
index 634728096ed..e32d35d8638 100644
--- a/src/test/ui/iterators/into-iter-on-arrays-lint.stderr
+++ b/src/test/ui/iterators/into-iter-on-arrays-lint.stderr
@@ -1,5 +1,5 @@
 warning: this method call resolves to `<&[T; N] as IntoIterator>::into_iter` (due to backwards compatibility), but will resolve to <[T; N] as IntoIterator>::into_iter in Rust 2021
-  --> $DIR/into-iter-on-arrays-lint.rs:10:11
+  --> $DIR/into-iter-on-arrays-lint.rs:11:11
    |
 LL |     small.into_iter();
    |           ^^^^^^^^^
@@ -17,7 +17,7 @@ LL |     IntoIterator::into_iter(small);
    |     ++++++++++++++++++++++++     ~
 
 warning: this method call resolves to `<&[T; N] as IntoIterator>::into_iter` (due to backwards compatibility), but will resolve to <[T; N] as IntoIterator>::into_iter in Rust 2021
-  --> $DIR/into-iter-on-arrays-lint.rs:13:12
+  --> $DIR/into-iter-on-arrays-lint.rs:14:12
    |
 LL |     [1, 2].into_iter();
    |            ^^^^^^^^^
@@ -34,7 +34,7 @@ LL |     IntoIterator::into_iter([1, 2]);
    |     ++++++++++++++++++++++++      ~
 
 warning: this method call resolves to `<&[T; N] as IntoIterator>::into_iter` (due to backwards compatibility), but will resolve to <[T; N] as IntoIterator>::into_iter in Rust 2021
-  --> $DIR/into-iter-on-arrays-lint.rs:16:9
+  --> $DIR/into-iter-on-arrays-lint.rs:17:9
    |
 LL |     big.into_iter();
    |         ^^^^^^^^^
@@ -51,7 +51,7 @@ LL |     IntoIterator::into_iter(big);
    |     ++++++++++++++++++++++++   ~
 
 warning: this method call resolves to `<&[T; N] as IntoIterator>::into_iter` (due to backwards compatibility), but will resolve to <[T; N] as IntoIterator>::into_iter in Rust 2021
-  --> $DIR/into-iter-on-arrays-lint.rs:19:15
+  --> $DIR/into-iter-on-arrays-lint.rs:20:15
    |
 LL |     [0u8; 33].into_iter();
    |               ^^^^^^^^^
@@ -68,7 +68,7 @@ LL |     IntoIterator::into_iter([0u8; 33]);
    |     ++++++++++++++++++++++++         ~
 
 warning: this method call resolves to `<&[T; N] as IntoIterator>::into_iter` (due to backwards compatibility), but will resolve to <[T; N] as IntoIterator>::into_iter in Rust 2021
-  --> $DIR/into-iter-on-arrays-lint.rs:23:21
+  --> $DIR/into-iter-on-arrays-lint.rs:24:21
    |
 LL |     Box::new(small).into_iter();
    |                     ^^^^^^^^^ help: use `.iter()` instead of `.into_iter()` to avoid ambiguity: `iter`
@@ -77,7 +77,7 @@ LL |     Box::new(small).into_iter();
    = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/IntoIterator-for-arrays.html>
 
 warning: this method call resolves to `<&[T; N] as IntoIterator>::into_iter` (due to backwards compatibility), but will resolve to <[T; N] as IntoIterator>::into_iter in Rust 2021
-  --> $DIR/into-iter-on-arrays-lint.rs:26:22
+  --> $DIR/into-iter-on-arrays-lint.rs:27:22
    |
 LL |     Box::new([1, 2]).into_iter();
    |                      ^^^^^^^^^ help: use `.iter()` instead of `.into_iter()` to avoid ambiguity: `iter`
@@ -86,7 +86,7 @@ LL |     Box::new([1, 2]).into_iter();
    = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/IntoIterator-for-arrays.html>
 
 warning: this method call resolves to `<&[T; N] as IntoIterator>::into_iter` (due to backwards compatibility), but will resolve to <[T; N] as IntoIterator>::into_iter in Rust 2021
-  --> $DIR/into-iter-on-arrays-lint.rs:29:19
+  --> $DIR/into-iter-on-arrays-lint.rs:30:19
    |
 LL |     Box::new(big).into_iter();
    |                   ^^^^^^^^^ help: use `.iter()` instead of `.into_iter()` to avoid ambiguity: `iter`
@@ -95,7 +95,7 @@ LL |     Box::new(big).into_iter();
    = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/IntoIterator-for-arrays.html>
 
 warning: this method call resolves to `<&[T; N] as IntoIterator>::into_iter` (due to backwards compatibility), but will resolve to <[T; N] as IntoIterator>::into_iter in Rust 2021
-  --> $DIR/into-iter-on-arrays-lint.rs:32:25
+  --> $DIR/into-iter-on-arrays-lint.rs:33:25
    |
 LL |     Box::new([0u8; 33]).into_iter();
    |                         ^^^^^^^^^ help: use `.iter()` instead of `.into_iter()` to avoid ambiguity: `iter`
@@ -104,7 +104,7 @@ LL |     Box::new([0u8; 33]).into_iter();
    = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/IntoIterator-for-arrays.html>
 
 warning: this method call resolves to `<&[T; N] as IntoIterator>::into_iter` (due to backwards compatibility), but will resolve to <[T; N] as IntoIterator>::into_iter in Rust 2021
-  --> $DIR/into-iter-on-arrays-lint.rs:36:31
+  --> $DIR/into-iter-on-arrays-lint.rs:37:31
    |
 LL |     Box::new(Box::new(small)).into_iter();
    |                               ^^^^^^^^^ help: use `.iter()` instead of `.into_iter()` to avoid ambiguity: `iter`
@@ -113,7 +113,7 @@ LL |     Box::new(Box::new(small)).into_iter();
    = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/IntoIterator-for-arrays.html>
 
 warning: this method call resolves to `<&[T; N] as IntoIterator>::into_iter` (due to backwards compatibility), but will resolve to <[T; N] as IntoIterator>::into_iter in Rust 2021
-  --> $DIR/into-iter-on-arrays-lint.rs:39:32
+  --> $DIR/into-iter-on-arrays-lint.rs:40:32
    |
 LL |     Box::new(Box::new([1, 2])).into_iter();
    |                                ^^^^^^^^^ help: use `.iter()` instead of `.into_iter()` to avoid ambiguity: `iter`
@@ -122,7 +122,7 @@ LL |     Box::new(Box::new([1, 2])).into_iter();
    = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/IntoIterator-for-arrays.html>
 
 warning: this method call resolves to `<&[T; N] as IntoIterator>::into_iter` (due to backwards compatibility), but will resolve to <[T; N] as IntoIterator>::into_iter in Rust 2021
-  --> $DIR/into-iter-on-arrays-lint.rs:42:29
+  --> $DIR/into-iter-on-arrays-lint.rs:43:29
    |
 LL |     Box::new(Box::new(big)).into_iter();
    |                             ^^^^^^^^^ help: use `.iter()` instead of `.into_iter()` to avoid ambiguity: `iter`
@@ -131,7 +131,7 @@ LL |     Box::new(Box::new(big)).into_iter();
    = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/IntoIterator-for-arrays.html>
 
 warning: this method call resolves to `<&[T; N] as IntoIterator>::into_iter` (due to backwards compatibility), but will resolve to <[T; N] as IntoIterator>::into_iter in Rust 2021
-  --> $DIR/into-iter-on-arrays-lint.rs:45:35
+  --> $DIR/into-iter-on-arrays-lint.rs:46:35
    |
 LL |     Box::new(Box::new([0u8; 33])).into_iter();
    |                                   ^^^^^^^^^ help: use `.iter()` instead of `.into_iter()` to avoid ambiguity: `iter`