about summary refs log tree commit diff
path: root/src/test/codegen/src-hash-algorithm/src-hash-algorithm-md5.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2020-09-06 22:37:46 +0000
committerbors <bors@rust-lang.org>2020-09-06 22:37:46 +0000
commitdaad592fac4b9f582f0dfeb1c0ca5874b2a0b111 (patch)
tree4f768bdccb3f27c90e5c75911c6d57d8aed34074 /src/test/codegen/src-hash-algorithm/src-hash-algorithm-md5.rs
parente9440cbcde1ccc3cdc76ee796566303fa8be142d (diff)
parent9fa9208bd5c3725f98dd88f761956c01ce5fd527 (diff)
downloadrust-daad592fac4b9f582f0dfeb1c0ca5874b2a0b111.tar.gz
rust-daad592fac4b9f582f0dfeb1c0ca5874b2a0b111.zip
Auto merge of #6006 - ebroto:6001_unnecessary_sort_by, r=Manishearth
Restrict unnecessary_sort_by to non-reference, Copy types

`Vec::sort_by_key` closure parameter is `F: FnMut(&T) -> K`. The lint's suggestion destructures the `T` parameter; this was probably done to avoid different unnamed lifetimes when `K = Reverse<&T>`.

This change fixes two issues:
* Destructuring T when T is non-reference requires the type to be Copy, otherwise we would try to move from a shared reference. We make sure `T: Copy` holds.
* Make sure `T` is actually non-reference. I didn't go for destructuring multiple levels of references, as we would have to compensate in the closure body by removing derefs and maybe adding parens, which would add more complexity.

changelog: Restrict [`unnecessary_sort_by`] to non-reference, Copy types

Fixes #6001
Diffstat (limited to 'src/test/codegen/src-hash-algorithm/src-hash-algorithm-md5.rs')
0 files changed, 0 insertions, 0 deletions