Skip to content

Commit

Permalink
Merge pull request #1678 from alex/patch-1
Browse files Browse the repository at this point in the history
Added an additional example of lifetime elision
  • Loading branch information
traviscross authored Nov 19, 2024
2 parents 41ccb0e + 6be16ad commit d661ff9
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/lifetime-elision.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ fn get_mut2<'a>(&'a mut self) -> &'a mut dyn T; // expanded
fn args1<T: ToCStr>(&mut self, args: &[T]) -> &mut Command; // elided
fn args2<'a, 'b, T: ToCStr>(&'a mut self, args: &'b [T]) -> &'a mut Command; // expanded

fn other_args1<'a>(arg: &str) -> &'a str; // elided
fn other_args2<'a, 'b>(arg: &'b str) -> &'a str; // expanded

fn new1(buf: &mut [u8]) -> Thing<'_>; // elided - preferred
fn new2(buf: &mut [u8]) -> Thing; // elided
fn new3<'a>(buf: &'a mut [u8]) -> Thing<'a>; // expanded
Expand Down

0 comments on commit d661ff9

Please sign in to comment.