From f9ce37f4606ba4352378a073fa07e084acae0fca Mon Sep 17 00:00:00 2001 From: Danny McClanahan <1305167+cosmicexplorer@users.noreply.github.com> Date: Wed, 4 Jan 2023 13:26:34 -0500 Subject: [PATCH] lean on stable Ordering representation --- rust/bridge/shared/src/protocol.rs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/rust/bridge/shared/src/protocol.rs b/rust/bridge/shared/src/protocol.rs index 3986153fbb..d4808ec2d2 100644 --- a/rust/bridge/shared/src/protocol.rs +++ b/rust/bridge/shared/src/protocol.rs @@ -1,5 +1,5 @@ // -// Copyright 2021-2022 Signal Messenger, LLC. +// Copyright 2021-2023 Signal Messenger, LLC. // SPDX-License-Identifier: AGPL-3.0-only // @@ -117,11 +117,8 @@ bridge_get!(ProtocolAddress::name as Name -> &str, ffi = "address_get_name"); #[bridge_fn(ffi = "publickey_compare", node = "PublicKey_Compare")] fn ECPublicKey_Compare(key1: &PublicKey, key2: &PublicKey) -> i32 { - match key1.cmp(key2) { - std::cmp::Ordering::Less => -1, - std::cmp::Ordering::Equal => 0, - std::cmp::Ordering::Greater => 1, - } + // Rust encodes Ordering::{Less,Equal,Greater} as {-1,0,+1}. + key1.cmp(key2) as i32 } #[bridge_fn(ffi = "publickey_verify", node = "PublicKey_Verify")]