Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign uplint against impl trait in the argument position #2789
Comments
This comment has been minimized.
This comment has been minimized.
|
I don't think it currently is an officially discouraged practice especially since the RFC landed pretty recently. |
Manishearth
closed this
May 22, 2018
This comment has been minimized.
This comment has been minimized.
|
It currently isnt a discouraged practice just that one of the three ways to write generic function. With that, i think impl trait in args should be discouraged in code bases that disagree with using it. Having a lint for those who disagree with it would beneficial to those people. Those who dont just leave clippy lint |
This comment has been minimized.
This comment has been minimized.
rust-lang/rfcs#2444 (comment) seems to suggest that that will never happen. While we do have some unusual restriction lints, this is a special situation as there's loads of emotional stuff going on. I do not want to drag clippy into that discussion by offering a lint that goes against the majority of the community and against the official process for making changes. |
This comment has been minimized.
This comment has been minimized.
|
Agreed. Clippy does have restriction lints but those are not for "I dislike this", those are for specialized situations where you want additional restrictions. And yeah, as an emotional subject we're probably not going to touch it anyway. Clippy isn't an escape hatch around community process. |
This comment has been minimized.
This comment has been minimized.
|
I agree that dragging clippy into emotional battle would be absolutely horrible idea. the point, I want to make crystal clear is that if someone feels strongly enough about the topic to write a lint against the behaivor, I think having the ability for clippy to accept even though it might go against the grain but set to allow by default seems perfectly reasonable. if clippy cant do that for a techinical reason then possibly a new project needs to be created for unusual lints "community members" would like to support. in way, by being inclusive, clippy informal way of showing what kinda of code the community actually likes compared to what other "community members" or leaders thinks the community likes. |
This comment has been minimized.
This comment has been minimized.
|
Yes, clippy can accept such a lint, that doesn't mean it should. A separate project for this sounds great. |
This comment has been minimized.
This comment has been minimized.
|
for your comment @oli-obk, clippy has definitely did accept a lint that falls under "I dislike this". |
This comment has been minimized.
This comment has been minimized.
|
The shadow lints and the "else if without else" actually catch bugs in projects that have high safety requirements. The only lint that comes to mind that violates this rule is the assign_ops lint, and I'll happily accept a PR that removes this lint! |
This comment has been minimized.
This comment has been minimized.
|
I have to disagree with @oli-obk, if you actually bother to read the why for those clipply lints, they all mention, "community members" believe having those features makes readability worse. on, a finer note, being against the official process, isn't necessarily bad thing, It can be a good thing to show, how possibly broken an official process is. (I don't believe it is quite yet). my hope is that lint inclusion wasn't as bureaucratic as RFC process. however it is looking like it is. |
This comment has been minimized.
This comment has been minimized.
uhm... I literally read and categorized every lint description two months ago The
The shadow* lints say
If you prefer to have citations of coding guidelines or safety standards here, please open an issue or better yet a PR. Our lints and their descriptions depend on community members maintaining them, this is not our dayjob. |
This comment has been minimized.
This comment has been minimized.
|
The "why" in the codebase need not be the full set of reasons why. We're not great about documentation. Shadowing actually is problematic, but not too problematic. Those in safety-critical environments may like it. |
warlord500 commentedMay 22, 2018
•
edited
while rust has just introduced impl trait to stable, impl trait in the argument position should be an official discouraged practice because there are now three ways to write a generic function.
by linting against this we can encourage the older syntax more often
it also allows those who disagree with it to discourage it in their code base