diff --git a/install/src/command.rs b/install/src/command.rs index 8a81e1d72337ec..30996f564c1220 100644 --- a/install/src/command.rs +++ b/install/src/command.rs @@ -130,9 +130,8 @@ fn download_to_temp( impl Read for DownloadProgress { fn read(&mut self, buf: &mut [u8]) -> io::Result { - self.response.read(buf).map(|n| { + self.response.read(buf).inspect(|&n| { self.progress_bar.inc(n as u64); - n }) } } diff --git a/ledger/src/ancestor_iterator.rs b/ledger/src/ancestor_iterator.rs index dc1abc774114bc..50761e63d6286a 100644 --- a/ledger/src/ancestor_iterator.rs +++ b/ledger/src/ancestor_iterator.rs @@ -35,7 +35,7 @@ impl<'a> Iterator for AncestorIterator<'a> { fn next(&mut self) -> Option { let current = self.current; - current.map(|slot| { + current.inspect(|&slot| { if slot != 0 { self.current = self .blockstore @@ -45,7 +45,6 @@ impl<'a> Iterator for AncestorIterator<'a> { } else { self.current = None; } - slot }) } } diff --git a/poh/src/poh_recorder.rs b/poh/src/poh_recorder.rs index fab2d9f62559e6..4bbd0ad3eb8214 100644 --- a/poh/src/poh_recorder.rs +++ b/poh/src/poh_recorder.rs @@ -992,11 +992,10 @@ impl PohRecorder { self.send_entry_us += send_entry_us; send_entry_res?; let starting_transaction_index = - working_bank.transaction_index.map(|transaction_index| { + working_bank.transaction_index.inspect(|transaction_index| { let next_starting_transaction_index = transaction_index.saturating_add(num_transactions); working_bank.transaction_index = Some(next_starting_transaction_index); - transaction_index }); return Ok(starting_transaction_index); } diff --git a/remote-wallet/src/bin/ledger-udev.rs b/remote-wallet/src/bin/ledger-udev.rs index fef91aeb518158..0f7de7098914e9 100644 --- a/remote-wallet/src/bin/ledger-udev.rs +++ b/remote-wallet/src/bin/ledger-udev.rs @@ -27,9 +27,8 @@ fn main() -> Result<(), Box> { .append(true) .create(true) .open(LEDGER_UDEV_RULES_LOCATION) - .map_err(|e| { + .inspect_err(|_e| { println!("Could not write to file; this script requires sudo privileges"); - e })?; file.write_all(LEDGER_UDEV_RULES.as_bytes())?; diff --git a/svm/src/transaction_processor.rs b/svm/src/transaction_processor.rs index f7862724e7f314..fa2bd505948a24 100644 --- a/svm/src/transaction_processor.rs +++ b/svm/src/transaction_processor.rs @@ -407,9 +407,8 @@ impl TransactionBatchProcessor { let compute_budget_limits = process_compute_budget_instructions( message.program_instructions_iter(), ) - .map_err(|err| { + .inspect_err(|_err| { error_counters.invalid_compute_budget += 1; - err })?; let fee_payer_address = message.fee_payer(); diff --git a/test-validator/src/lib.rs b/test-validator/src/lib.rs index 218cf9e4141f18..a86b5c79d87070 100644 --- a/test-validator/src/lib.rs +++ b/test-validator/src/lib.rs @@ -629,14 +629,13 @@ impl TestValidatorGenesis { socket_addr_space, rpc_to_plugin_manager_receiver, ) - .map(|test_validator| { + .inspect(|test_validator| { let runtime = tokio::runtime::Builder::new_current_thread() .enable_io() .enable_time() .build() .unwrap(); runtime.block_on(test_validator.wait_for_nonzero_fees()); - test_validator }) } diff --git a/turbine/src/retransmit_stage.rs b/turbine/src/retransmit_stage.rs index 32537db6b9abe9..d8d13e7f935cad 100644 --- a/turbine/src/retransmit_stage.rs +++ b/turbine/src/retransmit_stage.rs @@ -265,9 +265,8 @@ fn retransmit( quic_endpoint_sender, stats, ) - .map_err(|err| { - stats.record_error(&err); - err + .inspect_err(|err| { + stats.record_error(err); }) .ok()?; Some((key.slot(), root_distance, num_nodes)) @@ -290,9 +289,8 @@ fn retransmit( quic_endpoint_sender, stats, ) - .map_err(|err| { - stats.record_error(&err); - err + .inspect_err(|err| { + stats.record_error(err); }) .ok()?; Some((key.slot(), root_distance, num_nodes))