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 upAdd a lint to warn on `T: Drop` bounds #3776
Conversation
badboy
approved these changes
Feb 17, 2019
clippy_lints/src/drop_bounds.rs Outdated
Manishearth
requested changes
Feb 17, 2019
oli-obk
reviewed
Feb 17, 2019
clippy_lints/src/drop_bounds.rs Outdated
This comment has been minimized.
This comment has been minimized.
|
Idk how hard it is to create a structured suggestion for this lint, but I'd be delighted if you tried to create one. Maybe modify a copy of the AST in place and pretty print that? |
This comment has been minimized.
This comment has been minimized.
|
I don't think suggestions would help very much. While "just remove the bound" would "fix" the code in the sense that it would stop the lint from firing and it wouldn't break anything that worked, the proper way to fix it is to switch to |
This comment has been minimized.
This comment has been minimized.
|
I also just realized that I hadn't actually tested this with |
notriddle
force-pushed the
notriddle:drop-bounds
branch
from
94fb1bb
to
1d5710d
Feb 17, 2019
notriddle
added some commits
Feb 17, 2019
notriddle
force-pushed the
notriddle:drop-bounds
branch
from
1d5710d
to
cb1c0b6
Feb 18, 2019
This comment has been minimized.
This comment has been minimized.
|
r=me with docs nit and travis passing |
notriddle
added some commits
Feb 19, 2019
This comment has been minimized.
This comment has been minimized.
|
Okay, @oli-obk. Fixed the formatting that Travis complained about and added the second paragraph to why-it's-bad. |
This comment has been minimized.
This comment has been minimized.
|
@bors r+ superb, thanks! |
This comment has been minimized.
This comment has been minimized.
|
|
This comment has been minimized.
This comment has been minimized.
bors
added a commit
that referenced
this pull request
Feb 19, 2019
This comment has been minimized.
This comment has been minimized.
|
|
notriddle commentedFeb 17, 2019
•
edited
What it does: Checks for generics with
std::ops::Dropas bounds.Why is this bad?
Dropbounds do not really accomplish anything.A type may have compiler-generated drop glue without implementing the
Droptrait itself. TheDroptrait also only has one method,Drop::drop, and that function is by fiat not callable in user code.So there is really no use case for using
Dropin trait bounds.Known problems: None.
Example:
Fixes #3773