Skip to content

Lint functions taking references as arguments but only use them to create an owned value #1563

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

Open
oli-obk opened this issue Feb 21, 2017 · 3 comments
Labels
A-lint Area: New lints E-hard Call for participation: This a hard problem and requires more experience or effort to work on good-first-issue These issues are a good way to get started with Clippy L-unnecessary Lint: Warn about unnecessary code T-middle Type: Probably requires verifiying types

Comments

@oli-obk
Copy link
Contributor

oli-obk commented Feb 21, 2017

A function that takes a &str and always converts it to a String, should be taking a String argument instead. This is hard to generalize, but we could start with anything implementing to_owned and only calling to_owned.

@oli-obk oli-obk added L-unnecessary Lint: Warn about unnecessary code good-first-issue These issues are a good way to get started with Clippy E-hard Call for participation: This a hard problem and requires more experience or effort to work on A-lint Area: New lints T-middle Type: Probably requires verifiying types labels Feb 21, 2017
@clarfonthey
Copy link

Perhaps we could generalise this to clone as well?

@Jabberer
Copy link

I'd like to take a whack at this if that's cool

@Manishearth
Copy link
Member

Go ahead!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lint Area: New lints E-hard Call for participation: This a hard problem and requires more experience or effort to work on good-first-issue These issues are a good way to get started with Clippy L-unnecessary Lint: Warn about unnecessary code T-middle Type: Probably requires verifiying types
Projects
None yet
Development

No branches or pull requests

5 participants