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

library/alloc/src/vec/splice.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use super::{Drain, Vec};
2121
pub struct Splice<
2222
'a,
2323
I: Iterator + 'a,
24-
#[unstable(feature = "allocator_api", issue = "32838")] A: Allocator + 'a = Global,
24+
#[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global,
2525
> {
2626
pub(super) drain: Drain<'a, I::Item, A>,
2727
pub(super) replace_with: I,

library/core/src/cell.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1709,7 +1709,7 @@ impl<'b> BorrowRefMut<'b> {
17091709
/// See the [module-level documentation](self) for more.
17101710
#[stable(feature = "rust1", since = "1.0.0")]
17111711
#[must_not_suspend = "holding a RefMut across suspend points can cause BorrowErrors"]
1712-
pub struct RefMut<'b, T: ?Sized + 'b> {
1712+
pub struct RefMut<'b, T: ?Sized> {
17131713
// NB: we use a pointer instead of `&'b mut T` to avoid `noalias` violations, because a
17141714
// `RefMut` argument doesn't hold exclusivity for its whole scope, only until it drops.
17151715
value: NonNull<T>,

library/core/src/ffi/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ pub struct VaListImpl<'f> {
347347
all supported platforms",
348348
issue = "44930"
349349
)]
350-
pub struct VaList<'a, 'f: 'a> {
350+
pub struct VaList<'a, 'f> {
351351
#[cfg(any(
352352
all(
353353
not(target_arch = "aarch64"),

library/core/src/fmt/builders.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ impl fmt::Write for PadAdapter<'_, '_> {
7676
#[must_use = "must eventually call `finish()` on Debug builders"]
7777
#[allow(missing_debug_implementations)]
7878
#[stable(feature = "debug_builders", since = "1.2.0")]
79-
pub struct DebugStruct<'a, 'b: 'a> {
79+
pub struct DebugStruct<'a, 'b> {
8080
fmt: &'a mut fmt::Formatter<'b>,
8181
result: fmt::Result,
8282
has_fields: bool,
@@ -265,7 +265,7 @@ impl<'a, 'b: 'a> DebugStruct<'a, 'b> {
265265
#[must_use = "must eventually call `finish()` on Debug builders"]
266266
#[allow(missing_debug_implementations)]
267267
#[stable(feature = "debug_builders", since = "1.2.0")]
268-
pub struct DebugTuple<'a, 'b: 'a> {
268+
pub struct DebugTuple<'a, 'b> {
269269
fmt: &'a mut fmt::Formatter<'b>,
270270
result: fmt::Result,
271271
fields: usize,
@@ -369,7 +369,7 @@ impl<'a, 'b: 'a> DebugTuple<'a, 'b> {
369369
}
370370
}
371371

372-
struct DebugInner<'a, 'b: 'a> {
372+
struct DebugInner<'a, 'b> {
373373
fmt: &'a mut fmt::Formatter<'b>,
374374
result: fmt::Result,
375375
has_fields: bool,
@@ -431,7 +431,7 @@ impl<'a, 'b: 'a> DebugInner<'a, 'b> {
431431
#[must_use = "must eventually call `finish()` on Debug builders"]
432432
#[allow(missing_debug_implementations)]
433433
#[stable(feature = "debug_builders", since = "1.2.0")]
434-
pub struct DebugSet<'a, 'b: 'a> {
434+
pub struct DebugSet<'a, 'b> {
435435
inner: DebugInner<'a, 'b>,
436436
}
437437

@@ -561,7 +561,7 @@ impl<'a, 'b: 'a> DebugSet<'a, 'b> {
561561
#[must_use = "must eventually call `finish()` on Debug builders"]
562562
#[allow(missing_debug_implementations)]
563563
#[stable(feature = "debug_builders", since = "1.2.0")]
564-
pub struct DebugList<'a, 'b: 'a> {
564+
pub struct DebugList<'a, 'b> {
565565
inner: DebugInner<'a, 'b>,
566566
}
567567

@@ -691,7 +691,7 @@ impl<'a, 'b: 'a> DebugList<'a, 'b> {
691691
#[must_use = "must eventually call `finish()` on Debug builders"]
692692
#[allow(missing_debug_implementations)]
693693
#[stable(feature = "debug_builders", since = "1.2.0")]
694-
pub struct DebugMap<'a, 'b: 'a> {
694+
pub struct DebugMap<'a, 'b> {
695695
fmt: &'a mut fmt::Formatter<'b>,
696696
result: fmt::Result,
697697
has_fields: bool,

library/core/src/option.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2079,7 +2079,7 @@ unsafe impl<A> TrustedLen for Item<A> {}
20792079
/// This `struct` is created by the [`Option::iter`] function.
20802080
#[stable(feature = "rust1", since = "1.0.0")]
20812081
#[derive(Debug)]
2082-
pub struct Iter<'a, A: 'a> {
2082+
pub struct Iter<'a, A> {
20832083
inner: Item<&'a A>,
20842084
}
20852085

@@ -2129,7 +2129,7 @@ impl<A> Clone for Iter<'_, A> {
21292129
/// This `struct` is created by the [`Option::iter_mut`] function.
21302130
#[stable(feature = "rust1", since = "1.0.0")]
21312131
#[derive(Debug)]
2132-
pub struct IterMut<'a, A: 'a> {
2132+
pub struct IterMut<'a, A> {
21332133
inner: Item<&'a mut A>,
21342134
}
21352135

library/core/src/result.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1891,7 +1891,7 @@ impl<'a, T, E> IntoIterator for &'a mut Result<T, E> {
18911891
/// Created by [`Result::iter`].
18921892
#[derive(Debug)]
18931893
#[stable(feature = "rust1", since = "1.0.0")]
1894-
pub struct Iter<'a, T: 'a> {
1894+
pub struct Iter<'a, T> {
18951895
inner: Option<&'a T>,
18961896
}
18971897

@@ -1940,7 +1940,7 @@ impl<T> Clone for Iter<'_, T> {
19401940
/// Created by [`Result::iter_mut`].
19411941
#[derive(Debug)]
19421942
#[stable(feature = "rust1", since = "1.0.0")]
1943-
pub struct IterMut<'a, T: 'a> {
1943+
pub struct IterMut<'a, T> {
19441944
inner: Option<&'a mut T>,
19451945
}
19461946

0 commit comments

Comments
 (0)