Uses next_back() (#32478)

This commit is contained in:
Brooks 2023-07-13 13:38:18 -04:00 committed by GitHub
parent 7143667dbe
commit 3c825f28a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -1055,7 +1055,7 @@ fn show_votes_and_credits(
} }
// Existence of this should guarantee the occurrence of vote truncation // Existence of this should guarantee the occurrence of vote truncation
let newest_history_entry = epoch_voting_history.iter().rev().next(); let newest_history_entry = epoch_voting_history.iter().next_back();
writeln!( writeln!(
f, f,

View File

@ -919,7 +919,7 @@ fn do_get_highest_bank_snapshot(
mut bank_snapshots: Vec<BankSnapshotInfo>, mut bank_snapshots: Vec<BankSnapshotInfo>,
) -> Option<BankSnapshotInfo> { ) -> Option<BankSnapshotInfo> {
bank_snapshots.sort_unstable(); bank_snapshots.sort_unstable();
bank_snapshots.into_iter().rev().next() bank_snapshots.into_iter().next_back()
} }
pub fn serialize_snapshot_data_file<F>(data_file_path: &Path, serializer: F) -> Result<u64> pub fn serialize_snapshot_data_file<F>(data_file_path: &Path, serializer: F) -> Result<u64>
@ -2285,7 +2285,7 @@ pub fn get_highest_full_snapshot_archive_info(
) -> Option<FullSnapshotArchiveInfo> { ) -> Option<FullSnapshotArchiveInfo> {
let mut full_snapshot_archives = get_full_snapshot_archives(full_snapshot_archives_dir); let mut full_snapshot_archives = get_full_snapshot_archives(full_snapshot_archives_dir);
full_snapshot_archives.sort_unstable(); full_snapshot_archives.sort_unstable();
full_snapshot_archives.into_iter().rev().next() full_snapshot_archives.into_iter().next_back()
} }
/// Get the path for the incremental snapshot archive with the highest slot, for a given full /// Get the path for the incremental snapshot archive with the highest slot, for a given full
@ -2305,7 +2305,7 @@ pub fn get_highest_incremental_snapshot_archive_info(
}) })
.collect::<Vec<_>>(); .collect::<Vec<_>>();
incremental_snapshot_archives.sort_unstable(); incremental_snapshot_archives.sort_unstable();
incremental_snapshot_archives.into_iter().rev().next() incremental_snapshot_archives.into_iter().next_back()
} }
pub fn purge_old_snapshot_archives( pub fn purge_old_snapshot_archives(