diff options
| author | jumbatm <jumbatm@gmail.com> | 2019-12-27 20:17:17 +1000 |
|---|---|---|
| committer | jumbatm <jumbatm@gmail.com> | 2019-12-27 23:21:32 +1000 |
| commit | 282635f2db06096f1d7f0a986cf39da4c39da449 (patch) | |
| tree | 7949211a2f239f08811b9ded002beb640ba70ea7 | |
| parent | 8c494866bebd24e71bff64063f24a5c0dc8db851 (diff) | |
| download | rust-282635f2db06096f1d7f0a986cf39da4c39da449.tar.gz rust-282635f2db06096f1d7f0a986cf39da4c39da449.zip | |
Clean up const-hack from #61635
| -rw-r--r-- | src/libcore/num/mod.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/libcore/num/mod.rs b/src/libcore/num/mod.rs index 39e2c7ca60c..2148b6c2b41 100644 --- a/src/libcore/num/mod.rs +++ b/src/libcore/num/mod.rs @@ -2037,7 +2037,11 @@ $EndFeature, " #[rustc_const_unstable(feature = "const_int_sign", issue = "53718")] #[inline] pub const fn signum(self) -> Self { - (self > 0) as Self - (self < 0) as Self + match self { + n if n > 0 => 1, + 0 => 0, + _ => -1, + } } } |
