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

catch unnecessary pass by values #21

Open
Manishearth opened this Issue Dec 7, 2014 · 3 comments

Comments

Projects
None yet
3 participants
@Manishearth
Copy link
Member

Manishearth commented Dec 7, 2014

If we're just accessing fields and methods, pass by reference might make more sense. Maybe.

@llogiq

This comment has been minimized.

Copy link
Collaborator

llogiq commented Sep 1, 2015

The problem here is that some functions actually should pass by value. Those functions tend to be named into_-something, drop or transmute, among others. Perhaps using a whitelist of name patterns would suffice to weed out most false positives – we could then also advise to either access by ref or rename the function.

@birkenfeld

This comment has been minimized.

Copy link
Collaborator

birkenfeld commented Sep 1, 2015

Well, I would assume that the into_ methods generally move out at least some parts of self.

But it's a good point that into_ should always take by value, kind of a complement lint. (And as_ and to_ should take a reference.)

@llogiq

This comment has been minimized.

Copy link
Collaborator

llogiq commented Sep 1, 2015

@birkenfeld added an issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment