Switch std::vec::PeekMut::pop from self to this parameter.
Since PeekMut implements Deref, it shouldn't have any methods of its own. See also: `std::collections::binary_heap::PeekMut::pop`
This commit is contained in:
1
.mailmap
1
.mailmap
@@ -609,6 +609,7 @@ Shohei Wada <pc@wada314.jp>
|
|||||||
Shotaro Yamada <sinkuu@sinkuu.xyz>
|
Shotaro Yamada <sinkuu@sinkuu.xyz>
|
||||||
Shotaro Yamada <sinkuu@sinkuu.xyz> <sinkuu@users.noreply.github.com>
|
Shotaro Yamada <sinkuu@sinkuu.xyz> <sinkuu@users.noreply.github.com>
|
||||||
Shyam Sundar B <shyambaskaran@outlook.com>
|
Shyam Sundar B <shyambaskaran@outlook.com>
|
||||||
|
Sidney Cammeresi <sac@cheesecake.org> <sac@readyset.io>
|
||||||
Simon Barber-Dueck <sbarberdueck@gmail.com> Simon BD <simon@server>
|
Simon Barber-Dueck <sbarberdueck@gmail.com> Simon BD <simon@server>
|
||||||
Simon Sapin <simon@exyr.org> <simon.sapin@exyr.org>
|
Simon Sapin <simon@exyr.org> <simon.sapin@exyr.org>
|
||||||
Simonas Kazlauskas <git@kazlauskas.me> Simonas Kazlauskas <github@kazlauskas.me>
|
Simonas Kazlauskas <git@kazlauskas.me> Simonas Kazlauskas <github@kazlauskas.me>
|
||||||
|
|||||||
@@ -29,9 +29,9 @@ impl<'a, T> PeekMut<'a, T> {
|
|||||||
|
|
||||||
/// Removes the peeked value from the vector and returns it.
|
/// Removes the peeked value from the vector and returns it.
|
||||||
#[unstable(feature = "vec_peek_mut", issue = "122742")]
|
#[unstable(feature = "vec_peek_mut", issue = "122742")]
|
||||||
pub fn pop(self) -> T {
|
pub fn pop(this: Self) -> T {
|
||||||
// SAFETY: PeekMut is only constructed if the vec is non-empty
|
// SAFETY: PeekMut is only constructed if the vec is non-empty
|
||||||
unsafe { self.vec.pop().unwrap_unchecked() }
|
unsafe { this.vec.pop().unwrap_unchecked() }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ use std::ops::Bound::*;
|
|||||||
use std::panic::{AssertUnwindSafe, catch_unwind};
|
use std::panic::{AssertUnwindSafe, catch_unwind};
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
use std::sync::atomic::{AtomicU32, Ordering};
|
use std::sync::atomic::{AtomicU32, Ordering};
|
||||||
use std::vec::{Drain, IntoIter};
|
use std::vec::{Drain, IntoIter, PeekMut};
|
||||||
|
|
||||||
use crate::testing::macros::struct_with_counted_drop;
|
use crate::testing::macros::struct_with_counted_drop;
|
||||||
|
|
||||||
@@ -2647,7 +2647,7 @@ fn test_peek_mut() {
|
|||||||
assert_eq!(*p, 2);
|
assert_eq!(*p, 2);
|
||||||
*p = 0;
|
*p = 0;
|
||||||
assert_eq!(*p, 0);
|
assert_eq!(*p, 0);
|
||||||
p.pop();
|
PeekMut::pop(p);
|
||||||
assert_eq!(vec.len(), 1);
|
assert_eq!(vec.len(), 1);
|
||||||
} else {
|
} else {
|
||||||
unreachable!()
|
unreachable!()
|
||||||
|
|||||||
Reference in New Issue
Block a user