Skip to content

Commit

Permalink
Add allow(unused_code) annotations to methods in indexmap (#143)
Browse files Browse the repository at this point in the history
  • Loading branch information
alice-i-cecile authored Jun 10, 2022
1 parent d960ac1 commit 59a8e27
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/indexmap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ mod vec {

/// Returns the contents of the vector as an array of length `M` if the length
/// of the vector is exactly `M`, otherwise returns `Err(self)`.
#[allow(unused_code)]
pub(super) fn into_array<const M: usize>(self) -> Result<[T; M], Self> {
if self.len() == M {
// This is how the unstable `MaybeUninit::array_assume_init` method does it
Expand Down Expand Up @@ -328,6 +329,7 @@ mod vec {
/// new_len is less than len, the Vec is simply truncated.
///
/// See also [`resize_default`](struct.Vec.html#method.resize_default).
#[allow(unused_code)]
pub(super) fn resize(&mut self, new_len: usize, value: T) -> Result<(), ()>
where
T: Clone,
Expand All @@ -354,6 +356,7 @@ mod vec {
/// If `new_len` is less than `len`, the `Vec` is simply truncated.
///
/// See also [`resize`](struct.Vec.html#method.resize).
#[allow(unused_code)]
pub(super) fn resize_default(&mut self, new_len: usize) -> Result<(), ()>
where
T: Clone + Default,
Expand All @@ -379,6 +382,7 @@ mod vec {
/// - The elements at `old_len..new_len` must be initialized.
///
/// [`capacity()`]: #method.capacity
#[allow(unused_code)]
pub(super) unsafe fn set_len(&mut self, new_len: usize) {
debug_assert!(new_len <= self.capacity());

Expand All @@ -394,6 +398,7 @@ mod vec {
/// # Panics
///
/// Panics if `index` is out of bounds.
#[allow(unused_code)]
pub(super) fn swap_remove(&mut self, index: usize) -> T {
assert!(index < self.len);
unsafe { self.swap_remove_unchecked(index) }
Expand Down Expand Up @@ -434,6 +439,7 @@ mod vec {
///
/// Always returns `true` if `needle` is an empty slice.
#[inline]
#[allow(unused_code)]
pub(super) fn starts_with(&self, needle: &[T]) -> bool
where
T: PartialEq,
Expand All @@ -446,6 +452,7 @@ mod vec {
///
/// Always returns `true` if `needle` is an empty slice.
#[inline]
#[allow(unused_code)]
pub(super) fn ends_with(&self, needle: &[T]) -> bool
where
T: PartialEq,
Expand Down

0 comments on commit 59a8e27

Please sign in to comment.