-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
correct suggestion for
map_with_unused_argument_over_ranges
in a `n…
…o_std` environment
- Loading branch information
1 parent
d99eae4
commit 3b0b8b0
Showing
4 changed files
with
34 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#![warn(clippy::map_with_unused_argument_over_ranges)] | ||
#![no_std] | ||
extern crate alloc; | ||
use alloc::vec::Vec; | ||
|
||
fn nostd(v: &mut [i32]) { | ||
let _: Vec<_> = core::iter::repeat_n(3 + 1, 10).collect(); | ||
} |
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#![warn(clippy::map_with_unused_argument_over_ranges)] | ||
#![no_std] | ||
extern crate alloc; | ||
use alloc::vec::Vec; | ||
|
||
fn nostd(v: &mut [i32]) { | ||
let _: Vec<_> = (0..10).map(|_| 3 + 1).collect(); | ||
} |
15 changes: 15 additions & 0 deletions
15
tests/ui/map_with_unused_argument_over_ranges_nostd.stderr
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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
error: map of a closure that does not depend on its parameter over a range | ||
--> tests/ui/map_with_unused_argument_over_ranges_nostd.rs:7:21 | ||
| | ||
LL | let _: Vec<_> = (0..10).map(|_| 3 + 1).collect(); | ||
| ^^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= note: `-D clippy::map-with-unused-argument-over-ranges` implied by `-D warnings` | ||
= help: to override `-D warnings` add `#[allow(clippy::map_with_unused_argument_over_ranges)]` | ||
help: remove the explicit range and use `repeat_n` | ||
| | ||
LL | let _: Vec<_> = core::iter::repeat_n(3 + 1, 10).collect(); | ||
| ~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~ | ||
|
||
error: aborting due to 1 previous error | ||
|