3 ms·
Good luck trying to make your Rust code actually slow with random `clone` here and there. You really have to find something huge, or in a tightest loop to even
by dpc_pw 6y ago
Good luck trying to make your Rust code actually slow with random `clone` here and there. You really have to find something huge, or in a tightest loop to even notice a difference. And most applications are IO bound on some DB connection anyway.
But it's a good advice. For some reason people tend to forget that copying stuff is super cheap, and most lifetime issues can be entirely avoided with a `.clone()`.
- paledot 6y agoOh yeah. I don't feel bad about `.clone()`, it tends to be when I make short-lived Strings when a str might suffice. Then I remember that I write PHP code at my day job.