Skip to content
This repository has been archived by the owner on Jan 22, 2025. It is now read-only.

Commit

Permalink
Removes unused retain_max_n_elements() (#34978)
Browse files Browse the repository at this point in the history
  • Loading branch information
brooksprumo authored Jan 26, 2024
1 parent e1260a9 commit 59c2f35
Showing 1 changed file with 0 additions and 11 deletions.
11 changes: 0 additions & 11 deletions runtime/src/snapshot_package.rs
Original file line number Diff line number Diff line change
Expand Up @@ -333,14 +333,3 @@ impl SnapshotKind {
matches!(self, SnapshotKind::IncrementalSnapshot(_))
}
}

/// Helper function to retain only max n of elements to the right of a vector,
/// viz. remove v.len() - n elements from the left of the vector.
#[inline(always)]
pub fn retain_max_n_elements<T>(v: &mut Vec<T>, n: usize) {
if v.len() > n {
let to_truncate = v.len() - n;
v.rotate_left(to_truncate);
v.truncate(n);
}
}

0 comments on commit 59c2f35

Please sign in to comment.