Unnecessary variable copy #5379

Closed
opened 2026-03-07 20:21:08 -06:00 by GiteaMirror · 5 comments
Owner

Originally created by @mvalois on GitHub (Oct 17, 2023).

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). 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.

@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.

@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.

@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.

@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

@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#5379