Fix example in lifetime guide

This rewrites the example to also be more aligned with
the same example given in the main tutorial.
auto merge of #14567 : cburgdorf/rust/patch-2, r=brson

This rewrites the example to also be more aligned with
the same example given in the main tutorial.