forked from rust-lang/rust
-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of rust-lang#95274 - jendrikw:slice-must-use, r=Dylan-DPC
add #[must_use] to functions of slice and its iterators. Continuation of rust-lang#92853. Tracking issue: rust-lang#89692.
- Loading branch information
Showing
6 changed files
with
30 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,28 @@ | ||
error: using `.iter().next()` on an array | ||
--> $DIR/iter_next_slice.rs:9:5 | ||
--> $DIR/iter_next_slice.rs:9:13 | ||
| | ||
LL | s.iter().next(); | ||
| ^^^^^^^^^^^^^^^ help: try calling: `s.get(0)` | ||
LL | let _ = s.iter().next(); | ||
| ^^^^^^^^^^^^^^^ help: try calling: `s.get(0)` | ||
| | ||
= note: `-D clippy::iter-next-slice` implied by `-D warnings` | ||
|
||
error: using `.iter().next()` on a Slice without end index | ||
--> $DIR/iter_next_slice.rs:12:5 | ||
--> $DIR/iter_next_slice.rs:12:13 | ||
| | ||
LL | s[2..].iter().next(); | ||
| ^^^^^^^^^^^^^^^^^^^^ help: try calling: `s.get(2)` | ||
LL | let _ = s[2..].iter().next(); | ||
| ^^^^^^^^^^^^^^^^^^^^ help: try calling: `s.get(2)` | ||
|
||
error: using `.iter().next()` on a Slice without end index | ||
--> $DIR/iter_next_slice.rs:15:5 | ||
--> $DIR/iter_next_slice.rs:15:13 | ||
| | ||
LL | v[5..].iter().next(); | ||
| ^^^^^^^^^^^^^^^^^^^^ help: try calling: `v.get(5)` | ||
LL | let _ = v[5..].iter().next(); | ||
| ^^^^^^^^^^^^^^^^^^^^ help: try calling: `v.get(5)` | ||
|
||
error: using `.iter().next()` on an array | ||
--> $DIR/iter_next_slice.rs:18:5 | ||
--> $DIR/iter_next_slice.rs:18:13 | ||
| | ||
LL | v.iter().next(); | ||
| ^^^^^^^^^^^^^^^ help: try calling: `v.get(0)` | ||
LL | let _ = v.iter().next(); | ||
| ^^^^^^^^^^^^^^^ help: try calling: `v.get(0)` | ||
|
||
error: aborting due to 4 previous errors | ||
|