Skip to content

Better names for method returning mutable references #588

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/binary_heap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ impl<T, K, S: VecStorage<T>> BinaryHeapInner<T, K, S> {
}
/// Get a mutable reference to the `BinaryHeap`, erasing the `N` const-generic.
pub fn as_mut_view(&mut self) -> &mut BinaryHeapView<T, K> {
S::as_binary_heap_mut_view(self)
S::as_binary_heap_view_mut(self)
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/deque.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ impl<T, S: VecStorage<T> + ?Sized> DequeInner<T, S> {

/// Get a mutable reference to the `Deque`, erasing the `N` const-generic.
pub fn as_mut_view(&mut self) -> &mut DequeView<T> {
S::as_deque_mut_view(self)
S::as_deque_view_mut(self)
}

/// Returns the maximum number of elements the deque can hold.
Expand Down
20 changes: 10 additions & 10 deletions src/vec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ mod storage {
fn as_vec_view<LenT: LenType>(this: &VecInner<T, LenT, Self>) -> &VecView<T, LenT>
where
Self: VecStorage<T>;
fn as_vec_mut_view<LenT: LenType>(
fn as_vec_view_mut<LenT: LenType>(
this: &mut VecInner<T, LenT, Self>,
) -> &mut VecView<T, LenT>
where
Expand All @@ -70,7 +70,7 @@ mod storage {
fn as_binary_heap_view<K>(this: &BinaryHeapInner<T, K, Self>) -> &BinaryHeapView<T, K>
where
Self: VecStorage<T>;
fn as_binary_heap_mut_view<K>(
fn as_binary_heap_view_mut<K>(
this: &mut BinaryHeapInner<T, K, Self>,
) -> &mut BinaryHeapView<T, K>
where
Expand All @@ -79,7 +79,7 @@ mod storage {
fn as_deque_view(this: &DequeInner<T, Self>) -> &DequeView<T>
where
Self: VecStorage<T>;
fn as_deque_mut_view(this: &mut DequeInner<T, Self>) -> &mut DequeView<T>
fn as_deque_view_mut(this: &mut DequeInner<T, Self>) -> &mut DequeView<T>
where
Self: VecStorage<T>;
}
Expand Down Expand Up @@ -108,7 +108,7 @@ mod storage {
{
this
}
fn as_vec_mut_view<LenT: LenType>(
fn as_vec_view_mut<LenT: LenType>(
this: &mut VecInner<T, LenT, Self>,
) -> &mut VecView<T, LenT>
where
Expand All @@ -123,7 +123,7 @@ mod storage {
{
this
}
fn as_binary_heap_mut_view<K>(
fn as_binary_heap_view_mut<K>(
this: &mut BinaryHeapInner<T, K, Self>,
) -> &mut BinaryHeapView<T, K>
where
Expand All @@ -137,7 +137,7 @@ mod storage {
{
this
}
fn as_deque_mut_view(this: &mut DequeInner<T, Self>) -> &mut DequeView<T>
fn as_deque_view_mut(this: &mut DequeInner<T, Self>) -> &mut DequeView<T>
where
Self: VecStorage<T>,
{
Expand All @@ -160,7 +160,7 @@ mod storage {
{
this
}
fn as_vec_mut_view<LenT: LenType>(
fn as_vec_view_mut<LenT: LenType>(
this: &mut VecInner<T, LenT, Self>,
) -> &mut VecView<T, LenT>
where
Expand All @@ -175,7 +175,7 @@ mod storage {
{
this
}
fn as_binary_heap_mut_view<K>(
fn as_binary_heap_view_mut<K>(
this: &mut BinaryHeapInner<T, K, Self>,
) -> &mut BinaryHeapView<T, K>
where
Expand All @@ -189,7 +189,7 @@ mod storage {
{
this
}
fn as_deque_mut_view(this: &mut DequeInner<T, Self>) -> &mut DequeView<T>
fn as_deque_view_mut(this: &mut DequeInner<T, Self>) -> &mut DequeView<T>
where
Self: VecStorage<T>,
{
Expand Down Expand Up @@ -528,7 +528,7 @@ impl<T, LenT: LenType, S: VecStorage<T> + ?Sized> VecInner<T, LenT, S> {
/// ```
#[inline]
pub fn as_mut_view(&mut self) -> &mut VecView<T, LenT> {
S::as_vec_mut_view(self)
S::as_vec_view_mut(self)
}

/// Returns a raw pointer to the vector’s buffer.
Expand Down