From 5e3725dce61d8d820646fb481042e2fb8a7716d5 Mon Sep 17 00:00:00 2001 From: Jujumba Date: Mon, 3 Feb 2025 22:21:22 +0100 Subject: [PATCH] fix arg name in `with_capacity` and `from_elem` --- src/lib.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 0bf6fbc..9469c44 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -321,11 +321,11 @@ impl BitVec { /// } /// ``` #[inline] - pub fn from_elem(nbits: usize, bit: bool) -> Self { - let nblocks = blocks_for_bits::(nbits); + pub fn from_elem(len: usize, bit: bool) -> Self { + let nblocks = blocks_for_bits::(len); let mut bit_vec = BitVec { storage: vec![if bit { !B::zero() } else { B::zero() }; nblocks], - nbits, + nbits: len, }; bit_vec.fix_last_block(); bit_vec @@ -339,9 +339,9 @@ impl BitVec { /// It is important to note that this function does not specify the /// *length* of the returned bitvector, but only the *capacity*. #[inline] - pub fn with_capacity(nbits: usize) -> Self { + pub fn with_capacity(capacity: usize) -> Self { BitVec { - storage: Vec::with_capacity(blocks_for_bits::(nbits)), + storage: Vec::with_capacity(blocks_for_bits::(capacity)), nbits: 0, } }