Fix logic bug in stream::Stream::filter_map doctest (#2765)

The operator for the modulo and the test were swapped, and using
"modulo zero" is undefined and results in an unconditional panic,
which is now caught with Rust 1.71 (unconditional_panic lint).
This commit is contained in:
Fabio Valentini
2023-07-24 22:51:44 +02:00
committed by GitHub
parent 47b876fb67
commit fc680d1cf1

View File

@@ -399,7 +399,7 @@ pub trait Stream {
///
/// let (_tx, rx) = mpsc::channel::<i32>(1);
/// let evens_plus_one = rx.filter_map(|x| {
/// if x % 0 == 2 {
/// if x % 2 == 0 {
/// Some(x + 1)
/// } else {
/// None