diff --git a/src/array/primitive/mod.rs b/src/array/primitive/mod.rs index d3143e093ff..c7474db5df4 100644 --- a/src/array/primitive/mod.rs +++ b/src/array/primitive/mod.rs @@ -186,7 +186,7 @@ impl PrimitiveArray { } } /// Try to convert this `PrimitiveArray` to a `MutablePrimitiveArray` - pub fn into_mutable(mut self) -> MaybeMut> { + pub fn into_mut(mut self) -> MaybeMut> { match (self.validity, self.values.get_vec()) { (None, None) => { MaybeMut::Immutable(PrimitiveArray::from_data(self.data_type, self.values, None)) @@ -200,7 +200,7 @@ impl PrimitiveArray { self.values, Some(bitmap), )), - (Some(bitmap), Some(v)) => match bitmap.into_inner() { + (Some(bitmap), Some(v)) => match bitmap.into_mut() { MaybeMut::Immutable(bitmap) => MaybeMut::Immutable(PrimitiveArray::from_data( self.data_type, self.values, diff --git a/src/bitmap/immutable.rs b/src/bitmap/immutable.rs index 745984e0a6a..bb2d8dbe834 100644 --- a/src/bitmap/immutable.rs +++ b/src/bitmap/immutable.rs @@ -178,7 +178,7 @@ impl Bitmap { } /// Try to convert this `Bitmap` to a `MutableBitmap` - pub fn into_inner(mut self) -> MaybeMut { + pub fn into_mut(mut self) -> MaybeMut { match ( self.offset, Arc::get_mut(&mut self.bytes).map(|b| b.get_vec()).flatten(), diff --git a/tests/it/array/primitive/to_mutable.rs b/tests/it/array/primitive/to_mutable.rs index 18dfb7d4301..cb2f1212794 100644 --- a/tests/it/array/primitive/to_mutable.rs +++ b/tests/it/array/primitive/to_mutable.rs @@ -9,13 +9,13 @@ fn array_to_mutable() { let arr = PrimitiveArray::from_data(DataType::Int32, data.into(), None); // to mutable push and freeze again - let mut mut_arr = arr.into_mutable().unwrap_mut(); + let mut mut_arr = arr.into_mut().unwrap_mut(); mut_arr.push(Some(5)); let immut: PrimitiveArray = mut_arr.into(); assert_eq!(immut.values().as_slice(), [1, 2, 3, 5]); // let's cause a realloc and see if miri is ok - let mut mut_arr = immut.into_mutable().unwrap_mut(); + let mut mut_arr = immut.into_mut().unwrap_mut(); mut_arr.extend_constant(256, Some(9)); let immut: PrimitiveArray = mut_arr.into(); assert_eq!(immut.values().len(), 256 + 4); @@ -28,7 +28,7 @@ fn array_to_mutable_not_owned() { let arr2 = arr.clone(); // to the `to_mutable` should fail and we should get back the original array - match arr2.into_mutable() { + match arr2.into_mut() { MaybeMut::Immutable(arr2) => { assert_eq!(arr, arr2); } @@ -43,10 +43,10 @@ fn array_to_mutable_validity() { // both have a single reference should be ok let bitmap = Bitmap::from_iter([true, false, true]); let arr = PrimitiveArray::from_data(DataType::Int32, data.clone().into(), Some(bitmap)); - assert!(matches!(arr.into_mutable(), MaybeMut::Mutable(_))); + assert!(matches!(arr.into_mut(), MaybeMut::Mutable(_))); // now we clone the bitmap increasing the ref count let bitmap = Bitmap::from_iter([true, false, true]); - let arr = PrimitiveArray::from_data(DataType::Int32, data.into(), Some(bitmap.clone())); - assert!(matches!(arr.into_mutable(), MaybeMut::Immutable(_))); + let arr = PrimitiveArray::from_data(DataType::Int32, data.into(), Some(bitmap)); + assert!(matches!(arr.into_mut(), MaybeMut::Immutable(_))); }