Skip to content

Commit c03d10c

Browse files
committedJul 21, 2022
Remove redundant lifetime bound from impl Borrow for Cow
The lifetime bound `B::Owned: 'a` is redundant and doesn't make a difference, because `Cow<'a, B>` comes with an implicit `B: 'a`, and associated types will outlive lifetimes outlived by the `Self` type (and all the trait's generic parameters, of which there are none in this case), so the implicit `B: 'a` implies `B::Owned: 'a` anyway. The explicit lifetime bound here does however end up in documentation, and that's confusing in my opinion, so let's remove it ^^
1 parent 62b272d commit c03d10c

File tree

1 file changed

+0
-1
lines changed

1 file changed

+0
-1
lines changed
 

‎library/alloc/src/borrow.rs

-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ use Cow::*;
2121
impl<'a, B: ?Sized> Borrow<B> for Cow<'a, B>
2222
where
2323
B: ToOwned,
24-
<B as ToOwned>::Owned: 'a,
2524
{
2625
fn borrow(&self) -> &B {
2726
&**self

0 commit comments

Comments
 (0)
Please sign in to comment.