From 59c2f3560992acb5e47058dcb58ce1b3d8aeb98f Mon Sep 17 00:00:00 2001 From: Brooks Date: Fri, 26 Jan 2024 18:34:47 -0500 Subject: [PATCH] Removes unused retain_max_n_elements() (#34978) --- runtime/src/snapshot_package.rs | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/runtime/src/snapshot_package.rs b/runtime/src/snapshot_package.rs index f5623c550a24bf..99af3ebbe6ee2a 100644 --- a/runtime/src/snapshot_package.rs +++ b/runtime/src/snapshot_package.rs @@ -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(v: &mut Vec, n: usize) { - if v.len() > n { - let to_truncate = v.len() - n; - v.rotate_left(to_truncate); - v.truncate(n); - } -}