9
submitted 9 months ago by SorteKanin@feddit.dk to c/rust@programming.dev
you are viewing a single comment's thread
view the rest of the comments
[-] SorteKanin@feddit.dk 3 points 9 months ago* (last edited 9 months ago)

I would say depends but generally I would think not? I mean say you clone a string because you move it in one place and also need to borrow it in another place. So you clone to avoid the borrow checker erroring out on that. As far as I know, there will be two different strings created with separate allocations and all (but I could be wrong).

this post was submitted on 11 Nov 2025
9 points (100.0% liked)

Rust

8252 readers
39 users here now

Welcome to the Rust community! This is a place to discuss about the Rust programming language.

Wormhole

!performance@programming.dev

Credits

  • The icon is a modified version of the official rust logo (changing the colors to a gradient and black background)

founded 3 years ago
MODERATORS