From ffbd15f087262893e8d319534b99b684c0091f50 Mon Sep 17 00:00:00 2001 From: Phoenix Kahlo Date: Mon, 23 Dec 2024 14:05:26 -0600 Subject: [PATCH] proto: Use match for grease with reserved version Reduces LOC. --- quinn-proto/src/endpoint.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/quinn-proto/src/endpoint.rs b/quinn-proto/src/endpoint.rs index 9de8de0c1..aa50262d2 100644 --- a/quinn-proto/src/endpoint.rs +++ b/quinn-proto/src/endpoint.rs @@ -179,11 +179,10 @@ impl Endpoint { } .encode(buf); // Grease with a reserved version - if version != 0x0a1a_2a3a { - buf.write::(0x0a1a_2a3a); - } else { - buf.write::(0x0a1a_2a4a); - } + buf.write::(match version { + 0x0a1a_2a3a => 0x0a1a_2a4a, + _ => 0x0a1a_2a3a, + }); for &version in &self.config.supported_versions { buf.write(version); }