Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unnecessary variable copy #3980

Closed
mvalois opened this issue Oct 17, 2023 · 5 comments
Closed

Unnecessary variable copy #3980

mvalois opened this issue Oct 17, 2023 · 5 comments

Comments

@mvalois
Copy link
Contributor

mvalois commented Oct 17, 2023

Is that clone really necessary?

let email = data.email.clone();

Removing that line
let mut user = User::new(email);

and moving ownership with

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

seems to be valid.

@BlackDex
Copy link
Collaborator

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

@mvalois
Copy link
Contributor Author

mvalois commented Oct 17, 2023

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

@mvalois mvalois closed this as completed Oct 17, 2023
@BlackDex
Copy link
Collaborator

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.

@mvalois
Copy link
Contributor Author

mvalois commented Oct 17, 2023

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

@mvalois
Copy link
Contributor Author

mvalois commented Oct 17, 2023

here it is #3981

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants