mirror of
https://github.com/rust-lang/futures-rs.git
synced 2026-01-25 03:26:14 +00:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user