parent
e3cf961d73
commit
7d8fa4b6a5
@ -0,0 +1,28 @@
|
||||
From 498252a35dd6e1b4f9c0b596dc52e5aee8fac8c4 Mon Sep 17 00:00:00 2001
|
||||
From: Fabio Valentini <decathorpe@gmail.com>
|
||||
Date: Sun, 23 Jul 2023 22:32:41 +0200
|
||||
Subject: [PATCH] Fix logic bug in stream::Stream::filter_map doctest
|
||||
|
||||
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).
|
||||
---
|
||||
src/stream/mod.rs | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/stream/mod.rs b/src/stream/mod.rs
|
||||
index 2d90362..9ad4eea 100644
|
||||
--- a/src/stream/mod.rs
|
||||
+++ b/src/stream/mod.rs
|
||||
@@ -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
|
||||
--
|
||||
2.41.0
|
||||
|
Loading…
Reference in new issue