Removes unused retain_max_n_elements() (#34978)

This commit is contained in:
Brooks 2024-01-26 18:34:47 -05:00 committed by GitHub
parent e1260a9604
commit 59c2f35609
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 0 additions and 11 deletions

View File

@ -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);
}
}