rust-clippy/tests/ui/default_instead_of_iter_empty.stderr
kyoto7250 2bb8c45026 feat(lint): add default_iter_empty
Update description in clippy_lints/src/default_iter_empty.rs

Co-authored-by: Fridtjof Stoldt <xFrednet@gmail.com>

Update clippy_lints/src/default_iter_empty.rs

Co-authored-by: Alex Macleod <alex@macleod.io>

Update clippy_lints/src/default_iter_empty.rs

Co-authored-by: Alex Macleod <alex@macleod.io>

renamed default_iter_empty to default_instead_of_iter_empty

Avoid duplicate messages

add tests for regression

rewrite 'Why is this bad?'

cargo dev fmt

delete default_iter_empty lint in renamed_lint.rs

rewrite a message in the suggestion

cargo dev update_lints --check
2022-06-17 21:34:36 +09:00

22 lines
983 B
Text

error: `std::iter::empty()` is the more idiomatic way
--> $DIR/default_instead_of_iter_empty.rs:13:13
|
LL | let _ = std::iter::Empty::<usize>::default();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `std::iter::empty::<usize>()`
|
= note: `-D clippy::default-instead-of-iter-empty` implied by `-D warnings`
error: `std::iter::empty()` is the more idiomatic way
--> $DIR/default_instead_of_iter_empty.rs:14:13
|
LL | let _ = std::iter::Empty::<HashMap<usize, usize>>::default();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `std::iter::empty::<HashMap<usize, usize>>()`
error: `std::iter::empty()` is the more idiomatic way
--> $DIR/default_instead_of_iter_empty.rs:15:41
|
LL | let _foo: std::iter::Empty<usize> = std::iter::Empty::default();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `std::iter::empty()`
error: aborting due to 3 previous errors