Use filter_map instead of filter and map

This commit is contained in:
Riccardo Casatta 2020-11-17 15:14:24 +01:00
parent 4d1617f4e0
commit 7a58d3dd7a
No known key found for this signature in database
GPG Key ID: FD986A969E450397

View File

@ -95,8 +95,7 @@ pub trait ElectrumLikeSync {
let max_index = call_result let max_index = call_result
.iter() .iter()
.enumerate() .enumerate()
.filter(|(_, v)| !v.is_empty()) .filter_map(|(i, v)| v.first().map(|_| i as u32))
.map(|(i, _)| i as u32)
.max(); .max();
if let Some(max) = max_index { if let Some(max) = max_index {
max_indexes.insert(script_type, max + (i * chunk_size) as u32); max_indexes.insert(script_type, max + (i * chunk_size) as u32);