Skip to content

Commit a1fd9ba

Browse files
authored
Rollup merge of #64531 - taiki-e:pin-self, r=Centril
Use shorthand syntax in the self parameter of methods of Pin
2 parents 52fa593 + 076e0ce commit a1fd9ba

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

Diff for: src/libcore/pin.rs

+9-9
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,7 @@ impl<P: Deref> Pin<P> {
549549
/// ruled out by the contract of `Pin::new_unchecked`.
550550
#[stable(feature = "pin", since = "1.33.0")]
551551
#[inline(always)]
552-
pub fn as_ref(self: &Pin<P>) -> Pin<&P::Target> {
552+
pub fn as_ref(&self) -> Pin<&P::Target> {
553553
unsafe { Pin::new_unchecked(&*self.pointer) }
554554
}
555555

@@ -586,7 +586,7 @@ impl<P: DerefMut> Pin<P> {
586586
/// ruled out by the contract of `Pin::new_unchecked`.
587587
#[stable(feature = "pin", since = "1.33.0")]
588588
#[inline(always)]
589-
pub fn as_mut(self: &mut Pin<P>) -> Pin<&mut P::Target> {
589+
pub fn as_mut(&mut self) -> Pin<&mut P::Target> {
590590
unsafe { Pin::new_unchecked(&mut *self.pointer) }
591591
}
592592

@@ -596,7 +596,7 @@ impl<P: DerefMut> Pin<P> {
596596
/// run before being overwritten, so no pinning guarantee is violated.
597597
#[stable(feature = "pin", since = "1.33.0")]
598598
#[inline(always)]
599-
pub fn set(self: &mut Pin<P>, value: P::Target)
599+
pub fn set(&mut self, value: P::Target)
600600
where
601601
P::Target: Sized,
602602
{
@@ -621,7 +621,7 @@ impl<'a, T: ?Sized> Pin<&'a T> {
621621
///
622622
/// [`pin` module]: ../../std/pin/index.html#projections-and-structural-pinning
623623
#[stable(feature = "pin", since = "1.33.0")]
624-
pub unsafe fn map_unchecked<U, F>(self: Pin<&'a T>, func: F) -> Pin<&'a U> where
624+
pub unsafe fn map_unchecked<U, F>(self, func: F) -> Pin<&'a U> where
625625
F: FnOnce(&T) -> &U,
626626
{
627627
let pointer = &*self.pointer;
@@ -648,7 +648,7 @@ impl<'a, T: ?Sized> Pin<&'a T> {
648648
/// ["pinning projections"]: ../../std/pin/index.html#projections-and-structural-pinning
649649
#[stable(feature = "pin", since = "1.33.0")]
650650
#[inline(always)]
651-
pub fn get_ref(self: Pin<&'a T>) -> &'a T {
651+
pub fn get_ref(self) -> &'a T {
652652
self.pointer
653653
}
654654
}
@@ -657,7 +657,7 @@ impl<'a, T: ?Sized> Pin<&'a mut T> {
657657
/// Converts this `Pin<&mut T>` into a `Pin<&T>` with the same lifetime.
658658
#[stable(feature = "pin", since = "1.33.0")]
659659
#[inline(always)]
660-
pub fn into_ref(self: Pin<&'a mut T>) -> Pin<&'a T> {
660+
pub fn into_ref(self) -> Pin<&'a T> {
661661
Pin { pointer: self.pointer }
662662
}
663663

@@ -672,7 +672,7 @@ impl<'a, T: ?Sized> Pin<&'a mut T> {
672672
/// with the same lifetime as the original `Pin`.
673673
#[stable(feature = "pin", since = "1.33.0")]
674674
#[inline(always)]
675-
pub fn get_mut(self: Pin<&'a mut T>) -> &'a mut T
675+
pub fn get_mut(self) -> &'a mut T
676676
where T: Unpin,
677677
{
678678
self.pointer
@@ -690,7 +690,7 @@ impl<'a, T: ?Sized> Pin<&'a mut T> {
690690
/// instead.
691691
#[stable(feature = "pin", since = "1.33.0")]
692692
#[inline(always)]
693-
pub unsafe fn get_unchecked_mut(self: Pin<&'a mut T>) -> &'a mut T {
693+
pub unsafe fn get_unchecked_mut(self) -> &'a mut T {
694694
self.pointer
695695
}
696696

@@ -710,7 +710,7 @@ impl<'a, T: ?Sized> Pin<&'a mut T> {
710710
///
711711
/// [`pin` module]: ../../std/pin/index.html#projections-and-structural-pinning
712712
#[stable(feature = "pin", since = "1.33.0")]
713-
pub unsafe fn map_unchecked_mut<U, F>(self: Pin<&'a mut T>, func: F) -> Pin<&'a mut U> where
713+
pub unsafe fn map_unchecked_mut<U, F>(self, func: F) -> Pin<&'a mut U> where
714714
F: FnOnce(&mut T) -> &mut U,
715715
{
716716
let pointer = Pin::get_unchecked_mut(self);

0 commit comments

Comments
 (0)