From 267a4d5b9d862ef7e5e787116e237f7d5dac0273 Mon Sep 17 00:00:00 2001 From: Zeeshan Ali Khan Date: Wed, 13 Aug 2025 12:09:23 +0200 Subject: [PATCH] Better names for method returning mutable references I believe these names are better because they are more consistent with the naming of their non-mutable siblings and also with the general conventions in the Rust world. --- src/binary_heap.rs | 2 +- src/deque.rs | 2 +- src/vec/mod.rs | 20 ++++++++++---------- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/binary_heap.rs b/src/binary_heap.rs index 31e2185fff..22b882a15c 100644 --- a/src/binary_heap.rs +++ b/src/binary_heap.rs @@ -193,7 +193,7 @@ impl> BinaryHeapInner { } /// Get a mutable reference to the `BinaryHeap`, erasing the `N` const-generic. pub fn as_mut_view(&mut self) -> &mut BinaryHeapView { - S::as_binary_heap_mut_view(self) + S::as_binary_heap_view_mut(self) } } diff --git a/src/deque.rs b/src/deque.rs index 63e0f51006..446cebbd21 100644 --- a/src/deque.rs +++ b/src/deque.rs @@ -196,7 +196,7 @@ impl + ?Sized> DequeInner { /// Get a mutable reference to the `Deque`, erasing the `N` const-generic. pub fn as_mut_view(&mut self) -> &mut DequeView { - S::as_deque_mut_view(self) + S::as_deque_view_mut(self) } /// Returns the maximum number of elements the deque can hold. diff --git a/src/vec/mod.rs b/src/vec/mod.rs index 29ad3e5726..52a5f830e2 100644 --- a/src/vec/mod.rs +++ b/src/vec/mod.rs @@ -61,7 +61,7 @@ mod storage { fn as_vec_view(this: &VecInner) -> &VecView where Self: VecStorage; - fn as_vec_mut_view( + fn as_vec_view_mut( this: &mut VecInner, ) -> &mut VecView where @@ -70,7 +70,7 @@ mod storage { fn as_binary_heap_view(this: &BinaryHeapInner) -> &BinaryHeapView where Self: VecStorage; - fn as_binary_heap_mut_view( + fn as_binary_heap_view_mut( this: &mut BinaryHeapInner, ) -> &mut BinaryHeapView where @@ -79,7 +79,7 @@ mod storage { fn as_deque_view(this: &DequeInner) -> &DequeView where Self: VecStorage; - fn as_deque_mut_view(this: &mut DequeInner) -> &mut DequeView + fn as_deque_view_mut(this: &mut DequeInner) -> &mut DequeView where Self: VecStorage; } @@ -108,7 +108,7 @@ mod storage { { this } - fn as_vec_mut_view( + fn as_vec_view_mut( this: &mut VecInner, ) -> &mut VecView where @@ -123,7 +123,7 @@ mod storage { { this } - fn as_binary_heap_mut_view( + fn as_binary_heap_view_mut( this: &mut BinaryHeapInner, ) -> &mut BinaryHeapView where @@ -137,7 +137,7 @@ mod storage { { this } - fn as_deque_mut_view(this: &mut DequeInner) -> &mut DequeView + fn as_deque_view_mut(this: &mut DequeInner) -> &mut DequeView where Self: VecStorage, { @@ -160,7 +160,7 @@ mod storage { { this } - fn as_vec_mut_view( + fn as_vec_view_mut( this: &mut VecInner, ) -> &mut VecView where @@ -175,7 +175,7 @@ mod storage { { this } - fn as_binary_heap_mut_view( + fn as_binary_heap_view_mut( this: &mut BinaryHeapInner, ) -> &mut BinaryHeapView where @@ -189,7 +189,7 @@ mod storage { { this } - fn as_deque_mut_view(this: &mut DequeInner) -> &mut DequeView + fn as_deque_view_mut(this: &mut DequeInner) -> &mut DequeView where Self: VecStorage, { @@ -528,7 +528,7 @@ impl + ?Sized> VecInner { /// ``` #[inline] pub fn as_mut_view(&mut self) -> &mut VecView { - S::as_vec_mut_view(self) + S::as_vec_view_mut(self) } /// Returns a raw pointer to the vector’s buffer.