Skip to content

Commit a520568

Browse files
committed
Elide lifetimes in libcore
1 parent 1661947 commit a520568

File tree

9 files changed

+72
-72
lines changed

9 files changed

+72
-72
lines changed

src/libcore/cell.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ impl<T:Copy> Cell<T> {
231231
/// ```
232232
#[inline]
233233
#[unstable(feature = "as_unsafe_cell", issue = "27708")]
234-
pub unsafe fn as_unsafe_cell<'a>(&'a self) -> &'a UnsafeCell<T> {
234+
pub unsafe fn as_unsafe_cell(&self) -> &UnsafeCell<T> {
235235
&self.value
236236
}
237237
}
@@ -387,7 +387,7 @@ impl<T: ?Sized> RefCell<T> {
387387
/// ```
388388
#[stable(feature = "rust1", since = "1.0.0")]
389389
#[inline]
390-
pub fn borrow<'a>(&'a self) -> Ref<'a, T> {
390+
pub fn borrow(&self) -> Ref<T> {
391391
match BorrowRef::new(&self.borrow) {
392392
Some(b) => Ref {
393393
_value: unsafe { &*self.value.get() },
@@ -433,7 +433,7 @@ impl<T: ?Sized> RefCell<T> {
433433
/// ```
434434
#[stable(feature = "rust1", since = "1.0.0")]
435435
#[inline]
436-
pub fn borrow_mut<'a>(&'a self) -> RefMut<'a, T> {
436+
pub fn borrow_mut(&self) -> RefMut<T> {
437437
match BorrowRefMut::new(&self.borrow) {
438438
Some(b) => RefMut {
439439
_value: unsafe { &mut *self.value.get() },
@@ -450,7 +450,7 @@ impl<T: ?Sized> RefCell<T> {
450450
/// This function is `unsafe` because `UnsafeCell`'s field is public.
451451
#[inline]
452452
#[unstable(feature = "as_unsafe_cell", issue = "27708")]
453-
pub unsafe fn as_unsafe_cell<'a>(&'a self) -> &'a UnsafeCell<T> {
453+
pub unsafe fn as_unsafe_cell(&self) -> &UnsafeCell<T> {
454454
&self.value
455455
}
456456
}
@@ -541,7 +541,7 @@ impl<'b, T: ?Sized> Deref for Ref<'b, T> {
541541
type Target = T;
542542

543543
#[inline]
544-
fn deref<'a>(&'a self) -> &'a T {
544+
fn deref(&self) -> &T {
545545
self._value
546546
}
547547
}
@@ -750,15 +750,15 @@ impl<'b, T: ?Sized> Deref for RefMut<'b, T> {
750750
type Target = T;
751751

752752
#[inline]
753-
fn deref<'a>(&'a self) -> &'a T {
753+
fn deref(&self) -> &T {
754754
self._value
755755
}
756756
}
757757

758758
#[stable(feature = "rust1", since = "1.0.0")]
759759
impl<'b, T: ?Sized> DerefMut for RefMut<'b, T> {
760760
#[inline]
761-
fn deref_mut<'a>(&'a mut self) -> &'a mut T {
761+
fn deref_mut(&mut self) -> &mut T {
762762
self._value
763763
}
764764
}

src/libcore/nonzero.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ impl<T: Zeroable> Deref for NonZero<T> {
5151
type Target = T;
5252

5353
#[inline]
54-
fn deref<'a>(&'a self) -> &'a T {
54+
fn deref(&self) -> &T {
5555
let NonZero(ref inner) = *self;
5656
inner
5757
}

src/libcore/num/flt2dec/bignum.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ macro_rules! define_bignum {
211211
self
212212
}
213213

214-
pub fn add_small<'a>(&'a mut self, other: $ty) -> &'a mut $name {
214+
pub fn add_small(&mut self, other: $ty) -> &mut $name {
215215
use num::flt2dec::bignum::FullOps;
216216

217217
let (mut carry, v) = self.base[0].full_add(other, false);
@@ -248,7 +248,7 @@ macro_rules! define_bignum {
248248

249249
/// Multiplies itself by a digit-sized `other` and returns its own
250250
/// mutable reference.
251-
pub fn mul_small<'a>(&'a mut self, other: $ty) -> &'a mut $name {
251+
pub fn mul_small(&mut self, other: $ty) -> &mut $name {
252252
use num::flt2dec::bignum::FullOps;
253253

254254
let mut sz = self.size;
@@ -267,7 +267,7 @@ macro_rules! define_bignum {
267267
}
268268

269269
/// Multiplies itself by `2^bits` and returns its own mutable reference.
270-
pub fn mul_pow2<'a>(&'a mut self, bits: usize) -> &'a mut $name {
270+
pub fn mul_pow2(&mut self, bits: usize) -> &mut $name {
271271
use mem;
272272

273273
let digitbits = mem::size_of::<$ty>() * 8;
@@ -308,7 +308,7 @@ macro_rules! define_bignum {
308308
}
309309

310310
/// Multiplies itself by `5^e` and returns its own mutable reference.
311-
pub fn mul_pow5<'a>(&'a mut self, mut e: usize) -> &'a mut $name {
311+
pub fn mul_pow5(&mut self, mut e: usize) -> &mut $name {
312312
use mem;
313313
use num::flt2dec::bignum::SMALL_POW5;
314314

@@ -377,7 +377,7 @@ macro_rules! define_bignum {
377377

378378
/// Divides itself by a digit-sized `other` and returns its own
379379
/// mutable reference *and* the remainder.
380-
pub fn div_rem_small<'a>(&'a mut self, other: $ty) -> (&'a mut $name, $ty) {
380+
pub fn div_rem_small(&mut self, other: $ty) -> (&mut $name, $ty) {
381381
use num::flt2dec::bignum::FullOps;
382382

383383
assert!(other > 0);

src/libcore/num/flt2dec/strategy/dragon.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ static POW10TO256: [Digit; 27] =
4242
0xcc5573c0, 0x65f9ef17, 0x55bc28f2, 0x80dcc7f7, 0xf46eeddc, 0x5fdcefce, 0x553f7];
4343

4444
#[doc(hidden)]
45-
pub fn mul_pow10<'a>(x: &'a mut Big, n: usize) -> &'a mut Big {
45+
pub fn mul_pow10(x: &mut Big, n: usize) -> &mut Big {
4646
debug_assert!(n < 512);
4747
if n & 7 != 0 { x.mul_small(POW10[n & 7]); }
4848
if n & 8 != 0 { x.mul_small(POW10[8]); }
@@ -54,7 +54,7 @@ pub fn mul_pow10<'a>(x: &'a mut Big, n: usize) -> &'a mut Big {
5454
x
5555
}
5656

57-
fn div_2pow10<'a>(x: &'a mut Big, mut n: usize) -> &'a mut Big {
57+
fn div_2pow10(x: &mut Big, mut n: usize) -> &mut Big {
5858
let largest = POW10.len() - 1;
5959
while n > largest {
6060
x.div_rem_small(POW10[largest]);

src/libcore/ops.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -965,7 +965,7 @@ pub trait Index<Idx: ?Sized> {
965965

966966
/// The method for the indexing (`Foo[Bar]`) operation
967967
#[stable(feature = "rust1", since = "1.0.0")]
968-
fn index<'a>(&'a self, index: Idx) -> &'a Self::Output;
968+
fn index(&self, index: Idx) -> &Self::Output;
969969
}
970970

971971
/// The `IndexMut` trait is used to specify the functionality of indexing
@@ -1008,7 +1008,7 @@ pub trait Index<Idx: ?Sized> {
10081008
pub trait IndexMut<Idx: ?Sized>: Index<Idx> {
10091009
/// The method for the indexing (`Foo[Bar]`) operation
10101010
#[stable(feature = "rust1", since = "1.0.0")]
1011-
fn index_mut<'a>(&'a mut self, index: Idx) -> &'a mut Self::Output;
1011+
fn index_mut(&mut self, index: Idx) -> &mut Self::Output;
10121012
}
10131013

10141014
/// An unbounded range.
@@ -1119,7 +1119,7 @@ pub trait Deref {
11191119

11201120
/// The method called to dereference a value
11211121
#[stable(feature = "rust1", since = "1.0.0")]
1122-
fn deref<'a>(&'a self) -> &'a Self::Target;
1122+
fn deref(&self) -> &Self::Target;
11231123
}
11241124

11251125
#[stable(feature = "rust1", since = "1.0.0")]
@@ -1180,7 +1180,7 @@ impl<'a, T: ?Sized> Deref for &'a mut T {
11801180
pub trait DerefMut: Deref {
11811181
/// The method called to mutably dereference a value
11821182
#[stable(feature = "rust1", since = "1.0.0")]
1183-
fn deref_mut<'a>(&'a mut self) -> &'a mut Self::Target;
1183+
fn deref_mut(&mut self) -> &mut Self::Target;
11841184
}
11851185

11861186
#[stable(feature = "rust1", since = "1.0.0")]

src/libcore/option.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ impl<T> Option<T> {
241241
/// ```
242242
#[inline]
243243
#[stable(feature = "rust1", since = "1.0.0")]
244-
pub fn as_ref<'r>(&'r self) -> Option<&'r T> {
244+
pub fn as_ref(&self) -> Option<&T> {
245245
match *self {
246246
Some(ref x) => Some(x),
247247
None => None,
@@ -262,7 +262,7 @@ impl<T> Option<T> {
262262
/// ```
263263
#[inline]
264264
#[stable(feature = "rust1", since = "1.0.0")]
265-
pub fn as_mut<'r>(&'r mut self) -> Option<&'r mut T> {
265+
pub fn as_mut(&mut self) -> Option<&mut T> {
266266
match *self {
267267
Some(ref mut x) => Some(x),
268268
None => None,
@@ -289,7 +289,7 @@ impl<T> Option<T> {
289289
#[unstable(feature = "as_slice",
290290
reason = "waiting for mut conventions",
291291
issue = "27776")]
292-
pub fn as_mut_slice<'r>(&'r mut self) -> &'r mut [T] {
292+
pub fn as_mut_slice(&mut self) -> &mut [T] {
293293
match *self {
294294
Some(ref mut x) => {
295295
let result: &mut [T] = slice::mut_ref_slice(x);
@@ -692,7 +692,7 @@ impl<T> Option<T> {
692692
#[inline]
693693
#[unstable(feature = "as_slice", since = "unsure of the utility here",
694694
issue = "27776")]
695-
pub fn as_slice<'a>(&'a self) -> &'a [T] {
695+
pub fn as_slice(&self) -> &[T] {
696696
match *self {
697697
Some(ref x) => slice::ref_slice(x),
698698
None => {

src/libcore/ptr.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,7 @@ impl<T:?Sized> Deref for Unique<T> {
468468
type Target = *mut T;
469469

470470
#[inline]
471-
fn deref<'a>(&'a self) -> &'a *mut T {
471+
fn deref(&self) -> &*mut T {
472472
unsafe { mem::transmute(&*self.pointer) }
473473
}
474474
}

src/libcore/slice.rs

+37-37
Original file line numberDiff line numberDiff line change
@@ -69,48 +69,48 @@ use raw::Slice as RawSlice;
6969
pub trait SliceExt {
7070
type Item;
7171

72-
fn split_at<'a>(&'a self, mid: usize) -> (&'a [Self::Item], &'a [Self::Item]);
73-
fn iter<'a>(&'a self) -> Iter<'a, Self::Item>;
74-
fn split<'a, P>(&'a self, pred: P) -> Split<'a, Self::Item, P>
72+
fn split_at(&self, mid: usize) -> (&[Self::Item], &[Self::Item]);
73+
fn iter(&self) -> Iter<Self::Item>;
74+
fn split<P>(&self, pred: P) -> Split<Self::Item, P>
7575
where P: FnMut(&Self::Item) -> bool;
76-
fn splitn<'a, P>(&'a self, n: usize, pred: P) -> SplitN<'a, Self::Item, P>
76+
fn splitn<P>(&self, n: usize, pred: P) -> SplitN<Self::Item, P>
7777
where P: FnMut(&Self::Item) -> bool;
78-
fn rsplitn<'a, P>(&'a self, n: usize, pred: P) -> RSplitN<'a, Self::Item, P>
78+
fn rsplitn<P>(&self, n: usize, pred: P) -> RSplitN<Self::Item, P>
7979
where P: FnMut(&Self::Item) -> bool;
80-
fn windows<'a>(&'a self, size: usize) -> Windows<'a, Self::Item>;
81-
fn chunks<'a>(&'a self, size: usize) -> Chunks<'a, Self::Item>;
82-
fn get<'a>(&'a self, index: usize) -> Option<&'a Self::Item>;
83-
fn first<'a>(&'a self) -> Option<&'a Self::Item>;
84-
fn tail<'a>(&'a self) -> &'a [Self::Item];
85-
fn init<'a>(&'a self) -> &'a [Self::Item];
86-
fn split_first<'a>(&'a self) -> Option<(&'a Self::Item, &'a [Self::Item])>;
87-
fn split_last<'a>(&'a self) -> Option<(&'a Self::Item, &'a [Self::Item])>;
88-
fn last<'a>(&'a self) -> Option<&'a Self::Item>;
89-
unsafe fn get_unchecked<'a>(&'a self, index: usize) -> &'a Self::Item;
80+
fn windows(&self, size: usize) -> Windows<Self::Item>;
81+
fn chunks(&self, size: usize) -> Chunks<Self::Item>;
82+
fn get(&self, index: usize) -> Option<&Self::Item>;
83+
fn first(&self) -> Option<&Self::Item>;
84+
fn tail(&self) -> &[Self::Item];
85+
fn init(&self) -> &[Self::Item];
86+
fn split_first(&self) -> Option<(&Self::Item, &[Self::Item])>;
87+
fn split_last(&self) -> Option<(&Self::Item, &[Self::Item])>;
88+
fn last(&self) -> Option<&Self::Item>;
89+
unsafe fn get_unchecked(&self, index: usize) -> &Self::Item;
9090
fn as_ptr(&self) -> *const Self::Item;
9191
fn binary_search_by<F>(&self, f: F) -> Result<usize, usize> where
9292
F: FnMut(&Self::Item) -> Ordering;
9393
fn len(&self) -> usize;
9494
fn is_empty(&self) -> bool { self.len() == 0 }
95-
fn get_mut<'a>(&'a mut self, index: usize) -> Option<&'a mut Self::Item>;
96-
fn iter_mut<'a>(&'a mut self) -> IterMut<'a, Self::Item>;
97-
fn first_mut<'a>(&'a mut self) -> Option<&'a mut Self::Item>;
98-
fn tail_mut<'a>(&'a mut self) -> &'a mut [Self::Item];
99-
fn init_mut<'a>(&'a mut self) -> &'a mut [Self::Item];
100-
fn split_first_mut<'a>(&'a mut self) -> Option<(&'a mut Self::Item, &'a mut [Self::Item])>;
101-
fn split_last_mut<'a>(&'a mut self) -> Option<(&'a mut Self::Item, &'a mut [Self::Item])>;
102-
fn last_mut<'a>(&'a mut self) -> Option<&'a mut Self::Item>;
103-
fn split_mut<'a, P>(&'a mut self, pred: P) -> SplitMut<'a, Self::Item, P>
95+
fn get_mut(&mut self, index: usize) -> Option<&mut Self::Item>;
96+
fn iter_mut(&mut self) -> IterMut<Self::Item>;
97+
fn first_mut(&mut self) -> Option<&mut Self::Item>;
98+
fn tail_mut(&mut self) -> &mut [Self::Item];
99+
fn init_mut(&mut self) -> &mut [Self::Item];
100+
fn split_first_mut(&mut self) -> Option<(&mut Self::Item, &mut [Self::Item])>;
101+
fn split_last_mut(&mut self) -> Option<(&mut Self::Item, &mut [Self::Item])>;
102+
fn last_mut(&mut self) -> Option<&mut Self::Item>;
103+
fn split_mut<P>(&mut self, pred: P) -> SplitMut<Self::Item, P>
104104
where P: FnMut(&Self::Item) -> bool;
105105
fn splitn_mut<P>(&mut self, n: usize, pred: P) -> SplitNMut<Self::Item, P>
106106
where P: FnMut(&Self::Item) -> bool;
107107
fn rsplitn_mut<P>(&mut self, n: usize, pred: P) -> RSplitNMut<Self::Item, P>
108108
where P: FnMut(&Self::Item) -> bool;
109-
fn chunks_mut<'a>(&'a mut self, chunk_size: usize) -> ChunksMut<'a, Self::Item>;
109+
fn chunks_mut(&mut self, chunk_size: usize) -> ChunksMut<Self::Item>;
110110
fn swap(&mut self, a: usize, b: usize);
111-
fn split_at_mut<'a>(&'a mut self, mid: usize) -> (&'a mut [Self::Item], &'a mut [Self::Item]);
111+
fn split_at_mut(&mut self, mid: usize) -> (&mut [Self::Item], &mut [Self::Item]);
112112
fn reverse(&mut self);
113-
unsafe fn get_unchecked_mut<'a>(&'a mut self, index: usize) -> &'a mut Self::Item;
113+
unsafe fn get_unchecked_mut(&mut self, index: usize) -> &mut Self::Item;
114114
fn as_mut_ptr(&mut self) -> *mut Self::Item;
115115

116116
fn position_elem(&self, t: &Self::Item) -> Option<usize> where Self::Item: PartialEq;
@@ -163,7 +163,7 @@ impl<T> SliceExt for [T] {
163163
}
164164

165165
#[inline]
166-
fn iter<'a>(&'a self) -> Iter<'a, T> {
166+
fn iter(&self) -> Iter<T> {
167167
unsafe {
168168
let p = if mem::size_of::<T>() == 0 {
169169
1 as *const _
@@ -182,7 +182,7 @@ impl<T> SliceExt for [T] {
182182
}
183183

184184
#[inline]
185-
fn split<'a, P>(&'a self, pred: P) -> Split<'a, T, P> where P: FnMut(&T) -> bool {
185+
fn split<P>(&self, pred: P) -> Split<T, P> where P: FnMut(&T) -> bool {
186186
Split {
187187
v: self,
188188
pred: pred,
@@ -191,7 +191,7 @@ impl<T> SliceExt for [T] {
191191
}
192192

193193
#[inline]
194-
fn splitn<'a, P>(&'a self, n: usize, pred: P) -> SplitN<'a, T, P> where
194+
fn splitn<P>(&self, n: usize, pred: P) -> SplitN<T, P> where
195195
P: FnMut(&T) -> bool,
196196
{
197197
SplitN {
@@ -204,7 +204,7 @@ impl<T> SliceExt for [T] {
204204
}
205205

206206
#[inline]
207-
fn rsplitn<'a, P>(&'a self, n: usize, pred: P) -> RSplitN<'a, T, P> where
207+
fn rsplitn<P>(&self, n: usize, pred: P) -> RSplitN<T, P> where
208208
P: FnMut(&T) -> bool,
209209
{
210210
RSplitN {
@@ -311,7 +311,7 @@ impl<T> SliceExt for [T] {
311311
}
312312

313313
#[inline]
314-
fn iter_mut<'a>(&'a mut self) -> IterMut<'a, T> {
314+
fn iter_mut(&mut self) -> IterMut<T> {
315315
unsafe {
316316
let p = if mem::size_of::<T>() == 0 {
317317
1 as *mut _
@@ -368,12 +368,12 @@ impl<T> SliceExt for [T] {
368368
}
369369

370370
#[inline]
371-
fn split_mut<'a, P>(&'a mut self, pred: P) -> SplitMut<'a, T, P> where P: FnMut(&T) -> bool {
371+
fn split_mut<P>(&mut self, pred: P) -> SplitMut<T, P> where P: FnMut(&T) -> bool {
372372
SplitMut { v: self, pred: pred, finished: false }
373373
}
374374

375375
#[inline]
376-
fn splitn_mut<'a, P>(&'a mut self, n: usize, pred: P) -> SplitNMut<'a, T, P> where
376+
fn splitn_mut<P>(&mut self, n: usize, pred: P) -> SplitNMut<T, P> where
377377
P: FnMut(&T) -> bool
378378
{
379379
SplitNMut {
@@ -386,7 +386,7 @@ impl<T> SliceExt for [T] {
386386
}
387387

388388
#[inline]
389-
fn rsplitn_mut<'a, P>(&'a mut self, n: usize, pred: P) -> RSplitNMut<'a, T, P> where
389+
fn rsplitn_mut<P>(&mut self, n: usize, pred: P) -> RSplitNMut<T, P> where
390390
P: FnMut(&T) -> bool,
391391
{
392392
RSplitNMut {
@@ -1410,15 +1410,15 @@ impl<'a, T> ExactSizeIterator for ChunksMut<'a, T> {}
14101410

14111411
/// Converts a pointer to A into a slice of length 1 (without copying).
14121412
#[unstable(feature = "ref_slice", issue = "27774")]
1413-
pub fn ref_slice<'a, A>(s: &'a A) -> &'a [A] {
1413+
pub fn ref_slice<A>(s: &A) -> &[A] {
14141414
unsafe {
14151415
from_raw_parts(s, 1)
14161416
}
14171417
}
14181418

14191419
/// Converts a pointer to A into a slice of length 1 (without copying).
14201420
#[unstable(feature = "ref_slice", issue = "27774")]
1421-
pub fn mut_ref_slice<'a, A>(s: &'a mut A) -> &'a mut [A] {
1421+
pub fn mut_ref_slice<A>(s: &mut A) -> &mut [A] {
14221422
unsafe {
14231423
from_raw_parts_mut(s, 1)
14241424
}

0 commit comments

Comments
 (0)