[GH-ISSUE #3980] Unnecessary variable copy #10551

Closed
opened 2026-04-20 13:57:44 -05:00 by GiteaMirror · 5 comments
Owner

Originally created by @mvalois on GitHub (Oct 17, 2023).
Original GitHub issue: https://github.com/dani-garcia/vaultwarden/issues/3980

Is that clone really necessary?
008a2cf298/src/api/admin.rs (L282)
Removing that line
008a2cf298/src/api/admin.rs (L287)
and moving ownership with

let mut user = User::new(data.email);

seems to be valid.

Originally created by @mvalois on GitHub (Oct 17, 2023). Original GitHub issue: https://github.com/dani-garcia/vaultwarden/issues/3980 Is that clone really necessary? https://github.com/dani-garcia/vaultwarden/blob/008a2cf298a5c367568957c9290fd88bee9b44af/src/api/admin.rs#L282 Removing that line https://github.com/dani-garcia/vaultwarden/blob/008a2cf298a5c367568957c9290fd88bee9b44af/src/api/admin.rs#L287 and moving ownership with ```rust let mut user = User::new(data.email); ``` seems to be valid.
Author
Owner

@BlackDex commented on GitHub (Oct 17, 2023):

PR's are more suited for this. But I'm fine adjusting this later during some admin updates.

<!-- gh-comment-id:1766816827 --> @BlackDex commented on GitHub (Oct 17, 2023): PR's are more suited for this. But I'm fine adjusting this later during some admin updates.
Author
Owner

@mvalois commented on GitHub (Oct 17, 2023):

Fine, I just wanted to discuss about it, I doubted I was correct. I'll push a PR. Thanks.

<!-- gh-comment-id:1766868673 --> @mvalois commented on GitHub (Oct 17, 2023): Fine, I just wanted to discuss about it, I doubted I was correct. I'll push a PR. Thanks.
Author
Owner

@BlackDex commented on GitHub (Oct 17, 2023):

Well, i think it was just an oversight during some other changes. email was used at more locations but was charged to use the new user instead i think.

<!-- gh-comment-id:1766871511 --> @BlackDex commented on GitHub (Oct 17, 2023): Well, i think it was just an oversight during some other changes. email was used at more locations but was charged to use the new user instead i think.
Author
Owner

@mvalois commented on GitHub (Oct 17, 2023):

Sure. I thought rustc or clippy would've seen that.

<!-- gh-comment-id:1766879512 --> @mvalois commented on GitHub (Oct 17, 2023): Sure. I thought rustc or clippy would've seen that.
Author
Owner

@mvalois commented on GitHub (Oct 17, 2023):

here it is #3981

<!-- gh-comment-id:1766988652 --> @mvalois commented on GitHub (Oct 17, 2023): here it is #3981
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/vaultwarden#10551