about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src
diff options
context:
space:
mode:
authorNicholas Nethercote <n.nethercote@gmail.com>2022-07-01 21:05:01 +1000
committerNicholas Nethercote <n.nethercote@gmail.com>2022-07-05 09:34:54 +1000
commit0ee79f2c5a13cae0ffaa43a21b7f11d1d7ad5316 (patch)
treef55f884cc944008e167c8223a0baea2e94d18ae9 /compiler/rustc_codegen_llvm/src
parent2c911dc16f2ac3237fca7c7626982e6f6a4d0e33 (diff)
downloadrust-0ee79f2c5a13cae0ffaa43a21b7f11d1d7ad5316.tar.gz
rust-0ee79f2c5a13cae0ffaa43a21b7f11d1d7ad5316.zip
Avoid the unnecessary innermost match in `partial_cmp`/`cmp`.
We currently do a match on the comparison of every field in a struct or
enum variant. But the last field has a degenerate match like this:
```
match ::core::cmp::Ord::cmp(&self.y, &other.y) {
    ::core::cmp::Ordering::Equal =>
	::core::cmp::Ordering::Equal,
    cmp => cmp,
},
```
This commit changes it to this:
```
::core::cmp::Ord::cmp(&self.y, &other.y),
```
This is fairly straightforward thanks to the existing `cs_fold1`
function.

The commit also removes the `cs_fold` function which is no longer used.

(Note: there is some repetition now in `cs_cmp` and `cs_partial_cmp`. I
will remove that in a follow-up PR.)
Diffstat (limited to 'compiler/rustc_codegen_llvm/src')
0 files changed, 0 insertions, 0 deletions