-
Notifications
You must be signed in to change notification settings - Fork 341
Open
Description
This means you sometimes can't use Result::expect on the result of exactly_one.
use itertools::Itertools;
fn foo(cows: impl Iterator<Item = i32>) -> i32 {
cows.exactly_one().expect("there should only be one cow")
}error[E0277]: `impl Iterator<Item = i32>` doesn't implement `Debug`
--> ...:3:24
|
2 | cows.exactly_one().expect("there should only be one cow")
| ^^^^^^ the trait `Debug` is not implemented for `impl Iterator<Item = i32>`
|
= note: required for `ExactlyOneError<impl Iterator<Item = i32>>` to implement `Debug`
...
You can work-around it by doing .collect_array().expect(...) and destructuring, but that's not convenient, or adding a Debug bound, but that leaks an implementation detail.
Metadata
Metadata
Assignees
Labels
No labels