Skip to content

Commit

Permalink
Fix copy-paste typo
Browse files Browse the repository at this point in the history
Thanks  clippy::match-same-arms \o/
  • Loading branch information
sgued committed Jul 16, 2022
1 parent 31615cd commit 34ef464
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions clippy_lints/src/iter_once_empty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ impl EarlyLintPass for IterOnceEmpty {
),
"iter_mut" => (
format!("std::iter::once(&mut {})", snippet(cx, i.span, "...")),
"this .iter call can be replaced with std::iter::once",
"this .iter_mut call can be replaced with std::iter::once",
),
"into_iter" => (
format!("std::iter::once({})", snippet(cx, i.span, "...")),
Expand All @@ -161,7 +161,7 @@ impl EarlyLintPass for IterOnceEmpty {
} else {
let msg = match method_name {
"iter" => "this .iter call can be replaced with std::iter::empty",
"iter_mut" => "this .iter call can be replaced with std::iter::empty",
"iter_mut" => "this .iter_mut call can be replaced with std::iter::empty",
"into_iter" => "this .into_iter call can be replaced with std::iter::empty",
_ => return,
};
Expand Down
4 changes: 2 additions & 2 deletions tests/ui/iter_empty.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ LL | assert_eq!([].into_iter().next(), Option::<i32>::None);
|
= note: `-D clippy::iter-empty` implied by `-D warnings`

error: this .iter call can be replaced with std::iter::empty
error: this .iter_mut call can be replaced with std::iter::empty
--> $DIR/iter_empty.rs:7:16
|
LL | assert_eq!([].iter_mut().next(), Option::<&mut i32>::None);
Expand All @@ -24,7 +24,7 @@ error: this .into_iter call can be replaced with std::iter::empty
LL | assert_eq!(None.into_iter().next(), Option::<i32>::None);
| ^^^^^^^^^^^^^^^^ help: try: `std::iter::empty()`

error: this .iter call can be replaced with std::iter::empty
error: this .iter_mut call can be replaced with std::iter::empty
--> $DIR/iter_empty.rs:10:16
|
LL | assert_eq!(None.iter_mut().next(), Option::<&mut i32>::None);
Expand Down
4 changes: 2 additions & 2 deletions tests/ui/iter_once.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ LL | assert_eq!([123].into_iter().next(), Some(123));
|
= note: `-D clippy::iter-once` implied by `-D warnings`

error: this .iter call can be replaced with std::iter::once
error: this .iter_mut call can be replaced with std::iter::once
--> $DIR/iter_once.rs:7:16
|
LL | assert_eq!([123].iter_mut().next(), Some(&mut 123));
Expand All @@ -24,7 +24,7 @@ error: this .into_iter call can be replaced with std::iter::once
LL | assert_eq!(Some(123).into_iter().next(), Some(123));
| ^^^^^^^^^^^^^^^^^^^^^ help: try: `std::iter::once(123)`

error: this .iter call can be replaced with std::iter::once
error: this .iter_mut call can be replaced with std::iter::once
--> $DIR/iter_once.rs:10:16
|
LL | assert_eq!(Some(123).iter_mut().next(), Some(&mut 123));
Expand Down

0 comments on commit 34ef464

Please sign in to comment.