mirror of
https://github.com/soywod/himalaya.git
synced 2024-11-22 02:50:19 +00:00
use map_while to count for always err case.
Reasons: - Filter_map will run forever if iterator only returns Err with lines. This is a possibility for "lines" iterators. - Map_while will break the mapping the moment the iterator returns error. Signed-off-by: Perma Alesheikh <me@prma.dev>
This commit is contained in:
parent
b417ad11a0
commit
2af1936ef8
4 changed files with 4 additions and 4 deletions
|
@ -88,7 +88,7 @@ impl MessageSaveCommand {
|
|||
io::stdin()
|
||||
.lock()
|
||||
.lines()
|
||||
.filter_map(Result::ok)
|
||||
.map_while(Result::ok)
|
||||
.collect::<Vec<String>>()
|
||||
.join("\r\n")
|
||||
};
|
||||
|
|
|
@ -110,7 +110,7 @@ impl MessageSendCommand {
|
|||
io::stdin()
|
||||
.lock()
|
||||
.lines()
|
||||
.filter_map(Result::ok)
|
||||
.map_while(Result::ok)
|
||||
.collect::<Vec<_>>()
|
||||
.join("\r\n")
|
||||
};
|
||||
|
|
|
@ -92,7 +92,7 @@ impl TemplateSaveCommand {
|
|||
io::stdin()
|
||||
.lock()
|
||||
.lines()
|
||||
.filter_map(Result::ok)
|
||||
.map_while(Result::ok)
|
||||
.collect::<Vec<String>>()
|
||||
.join("\n")
|
||||
};
|
||||
|
|
|
@ -113,7 +113,7 @@ impl TemplateSendCommand {
|
|||
io::stdin()
|
||||
.lock()
|
||||
.lines()
|
||||
.filter_map(Result::ok)
|
||||
.map_while(Result::ok)
|
||||
.collect::<Vec<_>>()
|
||||
.join("\n")
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue