_hovi_@lemmy.worldtoRust Programming@lemmy.ml•[newbie] one-liner to avoid "temporary value dropped while borrowed"?
2·
2 months agoAs someone else said I think the shadowing works well here.
I do also wanna mention that depending on why you need this conversion, you could use impl AsRef<std::path::Path>
for your function signature so it can accept or
. Then, just use that argument with e.g.
p.as_ref()
to get a in the function body
Might have needed the \s here