Skip to content

Commit 20ac17a

Browse files
author
Lukas Markeffsky
committed
remove explicit lifetime bounds that can be inferred
1 parent 859775c commit 20ac17a

File tree

27 files changed

+100
-101
lines changed

27 files changed

+100
-101
lines changed

library/alloc/src/borrow.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ where
176176
/// ```
177177
#[stable(feature = "rust1", since = "1.0.0")]
178178
#[cfg_attr(not(test), rustc_diagnostic_item = "Cow")]
179-
pub enum Cow<'a, B: ?Sized + 'a>
179+
pub enum Cow<'a, B: ?Sized>
180180
where
181181
B: ToOwned,
182182
{

library/alloc/src/collections/binary_heap.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ pub struct BinaryHeap<T> {
277277
///
278278
/// [`peek_mut`]: BinaryHeap::peek_mut
279279
#[stable(feature = "binary_heap_peek_mut", since = "1.12.0")]
280-
pub struct PeekMut<'a, T: 'a + Ord> {
280+
pub struct PeekMut<'a, T: Ord> {
281281
heap: &'a mut BinaryHeap<T>,
282282
sift: bool,
283283
}
@@ -1226,7 +1226,7 @@ impl<T> BinaryHeap<T> {
12261226
/// (because it was moved from or duplicated).
12271227
/// In drop, `Hole` will restore the slice by filling the hole
12281228
/// position with the value that was originally removed.
1229-
struct Hole<'a, T: 'a> {
1229+
struct Hole<'a, T> {
12301230
data: &'a mut [T],
12311231
elt: ManuallyDrop<T>,
12321232
pos: usize,
@@ -1301,7 +1301,7 @@ impl<T> Drop for Hole<'_, T> {
13011301
/// [`iter`]: BinaryHeap::iter
13021302
#[must_use = "iterators are lazy and do nothing unless consumed"]
13031303
#[stable(feature = "rust1", since = "1.0.0")]
1304-
pub struct Iter<'a, T: 'a> {
1304+
pub struct Iter<'a, T> {
13051305
iter: slice::Iter<'a, T>,
13061306
}
13071307

@@ -1476,7 +1476,7 @@ unsafe impl<T: Ord> TrustedLen for IntoIterSorted<T> {}
14761476
/// [`drain`]: BinaryHeap::drain
14771477
#[stable(feature = "drain", since = "1.6.0")]
14781478
#[derive(Debug)]
1479-
pub struct Drain<'a, T: 'a> {
1479+
pub struct Drain<'a, T> {
14801480
iter: vec::Drain<'a, T>,
14811481
}
14821482

library/alloc/src/collections/btree/map.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ impl<K: fmt::Debug, V: fmt::Debug> fmt::Debug for Iter<'_, K, V> {
369369
///
370370
/// [`iter_mut`]: BTreeMap::iter_mut
371371
#[stable(feature = "rust1", since = "1.0.0")]
372-
pub struct IterMut<'a, K: 'a, V: 'a> {
372+
pub struct IterMut<'a, K, V> {
373373
range: LazyLeafRange<marker::ValMut<'a>, K, V>,
374374
length: usize,
375375

@@ -547,7 +547,7 @@ impl<K: fmt::Debug, V: fmt::Debug> fmt::Debug for Range<'_, K, V> {
547547
/// [`range_mut`]: BTreeMap::range_mut
548548
#[must_use = "iterators are lazy and do nothing unless consumed"]
549549
#[stable(feature = "btree_range", since = "1.17.0")]
550-
pub struct RangeMut<'a, K: 'a, V: 'a> {
550+
pub struct RangeMut<'a, K, V> {
551551
inner: LeafRange<marker::ValMut<'a>, K, V>,
552552

553553
// Be invariant in `K` and `V`

library/alloc/src/collections/btree/map/entry.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ use Entry::*;
1919
#[cfg_attr(not(test), rustc_diagnostic_item = "BTreeEntry")]
2020
pub enum Entry<
2121
'a,
22-
K: 'a,
23-
V: 'a,
22+
K,
23+
V,
2424
#[unstable(feature = "allocator_api", issue = "32838")] A: Allocator + Clone = Global,
2525
> {
2626
/// A vacant entry.
@@ -100,7 +100,7 @@ impl<K: Debug + Ord, V: Debug, A: Allocator + Clone> Debug for OccupiedEntry<'_,
100100
///
101101
/// Contains the occupied entry, and the value that was not inserted.
102102
#[unstable(feature = "map_try_insert", issue = "82766")]
103-
pub struct OccupiedError<'a, K: 'a, V: 'a, A: Allocator + Clone = Global> {
103+
pub struct OccupiedError<'a, K, V, A: Allocator + Clone = Global> {
104104
/// The entry in the map that was already occupied.
105105
pub entry: OccupiedEntry<'a, K, V, A>,
106106
/// The value which was not inserted, because the entry was already occupied.

library/alloc/src/collections/btree/set.rs

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ impl<T: Clone, A: Allocator + Clone> Clone for BTreeSet<T, A> {
135135
/// [`iter`]: BTreeSet::iter
136136
#[must_use = "iterators are lazy and do nothing unless consumed"]
137137
#[stable(feature = "rust1", since = "1.0.0")]
138-
pub struct Iter<'a, T: 'a> {
138+
pub struct Iter<'a, T> {
139139
iter: Keys<'a, T, SetValZST>,
140140
}
141141

@@ -171,7 +171,7 @@ pub struct IntoIter<
171171
#[must_use = "iterators are lazy and do nothing unless consumed"]
172172
#[derive(Debug)]
173173
#[stable(feature = "btree_range", since = "1.17.0")]
174-
pub struct Range<'a, T: 'a> {
174+
pub struct Range<'a, T> {
175175
iter: super::map::Range<'a, T, SetValZST>,
176176
}
177177

@@ -186,12 +186,12 @@ pub struct Range<'a, T: 'a> {
186186
#[stable(feature = "rust1", since = "1.0.0")]
187187
pub struct Difference<
188188
'a,
189-
T: 'a,
189+
T,
190190
#[unstable(feature = "allocator_api", issue = "32838")] A: Allocator + Clone = Global,
191191
> {
192192
inner: DifferenceInner<'a, T, A>,
193193
}
194-
enum DifferenceInner<'a, T: 'a, A: Allocator + Clone> {
194+
enum DifferenceInner<'a, T, A: Allocator + Clone> {
195195
Stitch {
196196
// iterate all of `self` and some of `other`, spotting matches along the way
197197
self_iter: Iter<'a, T>,
@@ -240,7 +240,7 @@ impl<T: fmt::Debug, A: Allocator + Clone> fmt::Debug for Difference<'_, T, A> {
240240
#[must_use = "this returns the difference as an iterator, \
241241
without modifying either input set"]
242242
#[stable(feature = "rust1", since = "1.0.0")]
243-
pub struct SymmetricDifference<'a, T: 'a>(MergeIterInner<Iter<'a, T>>);
243+
pub struct SymmetricDifference<'a, T>(MergeIterInner<Iter<'a, T>>);
244244

245245
#[stable(feature = "collection_debug", since = "1.17.0")]
246246
impl<T: fmt::Debug> fmt::Debug for SymmetricDifference<'_, T> {
@@ -260,12 +260,12 @@ impl<T: fmt::Debug> fmt::Debug for SymmetricDifference<'_, T> {
260260
#[stable(feature = "rust1", since = "1.0.0")]
261261
pub struct Intersection<
262262
'a,
263-
T: 'a,
263+
T,
264264
#[unstable(feature = "allocator_api", issue = "32838")] A: Allocator + Clone = Global,
265265
> {
266266
inner: IntersectionInner<'a, T, A>,
267267
}
268-
enum IntersectionInner<'a, T: 'a, A: Allocator + Clone> {
268+
enum IntersectionInner<'a, T, A: Allocator + Clone> {
269269
Stitch {
270270
// iterate similarly sized sets jointly, spotting matches along the way
271271
a: Iter<'a, T>,
@@ -312,7 +312,7 @@ impl<T: Debug, A: Allocator + Clone> Debug for Intersection<'_, T, A> {
312312
#[must_use = "this returns the union as an iterator, \
313313
without modifying either input set"]
314314
#[stable(feature = "rust1", since = "1.0.0")]
315-
pub struct Union<'a, T: 'a>(MergeIterInner<Iter<'a, T>>);
315+
pub struct Union<'a, T>(MergeIterInner<Iter<'a, T>>);
316316

317317
#[stable(feature = "collection_debug", since = "1.17.0")]
318318
impl<T: fmt::Debug> fmt::Debug for Union<'_, T> {
@@ -1290,7 +1290,6 @@ pub struct DrainFilter<
12901290
F,
12911291
#[unstable(feature = "allocator_api", issue = "32838")] A: Allocator + Clone = Global,
12921292
> where
1293-
T: 'a,
12941293
F: 'a + FnMut(&T) -> bool,
12951294
{
12961295
pred: F,

library/alloc/src/collections/linked_list.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ struct Node<T> {
6666
/// documentation for more.
6767
#[must_use = "iterators are lazy and do nothing unless consumed"]
6868
#[stable(feature = "rust1", since = "1.0.0")]
69-
pub struct Iter<'a, T: 'a> {
69+
pub struct Iter<'a, T> {
7070
head: Option<NonNull<Node<T>>>,
7171
tail: Option<NonNull<Node<T>>>,
7272
len: usize,
@@ -102,7 +102,7 @@ impl<T> Clone for Iter<'_, T> {
102102
/// documentation for more.
103103
#[must_use = "iterators are lazy and do nothing unless consumed"]
104104
#[stable(feature = "rust1", since = "1.0.0")]
105-
pub struct IterMut<'a, T: 'a> {
105+
pub struct IterMut<'a, T> {
106106
head: Option<NonNull<Node<T>>>,
107107
tail: Option<NonNull<Node<T>>>,
108108
len: usize,
@@ -1139,7 +1139,7 @@ impl<T> FusedIterator for IterMut<'_, T> {}
11391139
///
11401140
/// When created, cursors start at the front of the list, or the "ghost" non-element if the list is empty.
11411141
#[unstable(feature = "linked_list_cursors", issue = "58533")]
1142-
pub struct Cursor<'a, T: 'a> {
1142+
pub struct Cursor<'a, T> {
11431143
index: usize,
11441144
current: Option<NonNull<Node<T>>>,
11451145
list: &'a LinkedList<T>,
@@ -1171,7 +1171,7 @@ impl<T: fmt::Debug> fmt::Debug for Cursor<'_, T> {
11711171
/// To accommodate this, there is a "ghost" non-element that yields `None` between the head and
11721172
/// tail of the list.
11731173
#[unstable(feature = "linked_list_cursors", issue = "58533")]
1174-
pub struct CursorMut<'a, T: 'a> {
1174+
pub struct CursorMut<'a, T> {
11751175
index: usize,
11761176
current: Option<NonNull<Node<T>>>,
11771177
list: &'a mut LinkedList<T>,
@@ -1702,7 +1702,7 @@ impl<'a, T> CursorMut<'a, T> {
17021702

17031703
/// An iterator produced by calling `drain_filter` on LinkedList.
17041704
#[unstable(feature = "drain_filter", reason = "recently added", issue = "43244")]
1705-
pub struct DrainFilter<'a, T: 'a, F: 'a>
1705+
pub struct DrainFilter<'a, T, F: 'a>
17061706
where
17071707
F: FnMut(&mut T) -> bool,
17081708
{

library/alloc/src/collections/vec_deque/drain.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use super::{count, wrap_index, VecDeque};
1717
#[stable(feature = "drain", since = "1.6.0")]
1818
pub struct Drain<
1919
'a,
20-
T: 'a,
20+
T,
2121
#[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global,
2222
> {
2323
after_tail: usize,

library/alloc/src/collections/vec_deque/iter.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use super::{count, wrap_index, RingSlices};
1212
///
1313
/// [`iter`]: super::VecDeque::iter
1414
#[stable(feature = "rust1", since = "1.0.0")]
15-
pub struct Iter<'a, T: 'a> {
15+
pub struct Iter<'a, T> {
1616
ring: &'a [MaybeUninit<T>],
1717
tail: usize,
1818
head: usize,

library/alloc/src/collections/vec_deque/iter_mut.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use super::{count, wrap_index, RingSlices};
1111
///
1212
/// [`iter_mut`]: super::VecDeque::iter_mut
1313
#[stable(feature = "rust1", since = "1.0.0")]
14-
pub struct IterMut<'a, T: 'a> {
14+
pub struct IterMut<'a, T> {
1515
// Internal safety invariant: the entire slice is dereferenceable.
1616
ring: *mut [T],
1717
tail: usize,

library/alloc/src/vec/drain.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use super::Vec;
2121
#[stable(feature = "drain", since = "1.6.0")]
2222
pub struct Drain<
2323
'a,
24-
T: 'a,
24+
T,
2525
#[unstable(feature = "allocator_api", issue = "32838")] A: Allocator + 'a = Global,
2626
> {
2727
/// Index of tail to preserve

0 commit comments

Comments
 (0)