diff options
| author | Philipp Krones <hello@philkrones.com> | 2020-08-04 12:06:40 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-08-04 12:06:40 +0200 |
| commit | 888067c623387d615504f595c097e2da55f6b123 (patch) | |
| tree | 48b7c596fb5d31d2d10b50cc18530e060d8d39ab /src/test/rustdoc-ui/coverage/json.rs | |
| parent | 378ba2e03e192cbf3a416c151c6fe98e69375e25 (diff) | |
| parent | 94b10a6e5ab003a03b6c7b60ffe5a3b366e0529a (diff) | |
| download | rust-888067c623387d615504f595c097e2da55f6b123.tar.gz rust-888067c623387d615504f595c097e2da55f6b123.zip | |
Rollup merge of #5848 - Ryan1729:add-derive_ord_xor_partial_ord-lint, r=matthiaskrgr
Add derive_ord_xor_partial_ord lint Fix #1621 Some remarks: This PR follows the example of the analogous derive_hash_xor_partial_eq lint where possible. I initially tried using the `match_path` function to identify `Ord` implementation like the derive_hash_xor_partial_eq lint currently does, for `Hash` implementations but that didn't work. Specifically, the structs at the top level were getting paths that matched `&["$crate", "cmp", "Ord"]` instead of `&["std", "cmp", "Ord"]`. While trying to figure out what to do instead I saw the comment at the top of [clippy_lints/src/utils/paths.rs](https://github.com/rust-lang/rust-clippy/blob/f5d429cd762423901f946abd800dc2cd91366ccf/clippy_lints/src/utils/paths.rs#L5) that mentioned [this issue](https://github.com/rust-lang/rust-clippy/issues/5393) and suggested to use diagnostic items instead of hardcoded paths whenever possible. I looked for a way to identify `Ord` implementations with diagnostic items, but (possibly because this was the first time I had heard of diagnostic items,) I was unable to find one. Eventually I tried using `get_trait_def_id` and comparing `DefId` values directly and that seems to work as expected. Maybe there's a better approach however? changelog: new lint: derive_ord_xor_partial_ord
Diffstat (limited to 'src/test/rustdoc-ui/coverage/json.rs')
0 files changed, 0 insertions, 0 deletions
