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

Lint against Rc<String> (and Rc<Vec<T>>) #2623

Closed
birkenfeld opened this issue Apr 3, 2018 · 6 comments · Fixed by #6044
Closed

Lint against Rc<String> (and Rc<Vec<T>>) #2623

birkenfeld opened this issue Apr 3, 2018 · 6 comments · Fixed by #6044
Labels
A-lint Area: New lints good-first-issue These issues are a good way to get started with Clippy L-guidelines Lint: Related to the Rust API Guidelines L-unnecessary Lint: Warn about unnecessary code T-middle Type: Probably requires verifiying types

Comments

@birkenfeld
Copy link
Contributor

Now that it's easy to construct Rc<str> and Rc<[T]> using into(), we should advise people to use them.

Especially Rc<String> is often advised to avoid cloning strings, but has no advantages (except if you want to use get_mut) and is a) larger, b) has one more pointer to chase, and c) doesn't implement Borrow<str>.

@oli-obk oli-obk added good-first-issue These issues are a good way to get started with Clippy T-middle Type: Probably requires verifiying types A-lint Area: New lints L-unnecessary Lint: Warn about unnecessary code L-guidelines Lint: Related to the Rust API Guidelines labels Apr 3, 2018
@compressed
Copy link

Agreed! The lint should also apply for Arc since the change does as well.

@rudyardrichter
Copy link

Could I take on this issue? Would love to start contributing somewhere :)

@oli-obk
Copy link
Contributor

oli-obk commented May 1, 2018

All yours. Please put it in the nursery group for now

@rudyardrichter
Copy link

@oli-obk I took a crack at this last weekend and have a better understanding now of what should be required, but I definitely have some questions for implementation—anyone in particular I could bug about it?

@oli-obk
Copy link
Contributor

oli-obk commented May 14, 2018

@rudyardrichter you can bug me ;) or anyone in the #clippy irc channel

Or just ask here. Or open a half finished PR.

Lots of possibilities. Choose the one that's most convenient for you

@pickfire
Copy link
Contributor

is this affected by rust-lang/rust#61953?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lint Area: New lints good-first-issue These issues are a good way to get started with Clippy L-guidelines Lint: Related to the Rust API Guidelines L-unnecessary Lint: Warn about unnecessary code T-middle Type: Probably requires verifiying types
Projects
None yet
6 participants