This website requires JavaScript.
Explore
Help
Sign In
Mirrors
/
rust-clippy
Watch
2
Star
0
Fork
You've already forked rust-clippy
0
mirror of
https://github.com/rust-lang/rust-clippy
synced
2024-11-24 05:33:27 +00:00
Code
Issues
Projects
Releases
Packages
Wiki
Activity
f8e892db5e
rust-clippy
/
tests
/
ui
/
drop_bounds.rs
9 lines
87 B
Rust
Raw
Normal View
History
Unescape
Escape
Add a lint to warn on `T: Drop` bounds **What it does:** Checks for generics with `std::ops::Drop` as bounds. **Why is this bad?** `Drop` bounds do not really accomplish anything. A type may have compiler-generated drop glue without implementing the `Drop` trait itself. The `Drop` trait 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 `Drop` in trait bounds. **Known problems:** None. **Example:** ```rust fn foo<T: Drop>() {} ```
2019-02-17 04:28:16 +00:00
#![
allow(unused)
]
fn
foo
<
T
:
Drop
>
(
)
{
}
Fix formatting
2019-02-19 02:36:58 +00:00
fn
bar
<
T
>
(
)
where
T
:
Drop
,
{
}
Add a lint to warn on `T: Drop` bounds **What it does:** Checks for generics with `std::ops::Drop` as bounds. **Why is this bad?** `Drop` bounds do not really accomplish anything. A type may have compiler-generated drop glue without implementing the `Drop` trait itself. The `Drop` trait 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 `Drop` in trait bounds. **Known problems:** None. **Example:** ```rust fn foo<T: Drop>() {} ```
2019-02-17 04:28:16 +00:00
fn
main
(
)
{
}
Reference in a new issue
Copy permalink