Unnecessary lifetime parameter

โš“ Rust    ๐Ÿ“… 2025-07-29    ๐Ÿ‘ค surdeus    ๐Ÿ‘๏ธ 12      

surdeus

Warning

This post was published 127 days ago. The information described in this article may have changed.

Iโ€™ve got code that looks a bit like this:

struct A<B: SomeTrait> {x: B::Sub};

struct C<'a> {y: &'a Z};

impl<'a> SomeTrait for C {type Sub = X;}

type D<'a> = A<C<'a>>;

Is it possible to get rid of the <'a> in type D<'a> , since itโ€™s not really doing anything there?

5 posts - 4 participants

Read full topic

๐Ÿท๏ธ Rust_feed