Skip to content

Commit

Permalink
Fix logic bug in stream::Stream::filter_map doctest (#2765)
Browse files Browse the repository at this point in the history
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).
  • Loading branch information
decathorpe authored Jul 24, 2023
1 parent 47b876f commit fc680d1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/stream/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit fc680d1

Please sign in to comment.