From fa27532141666598293b3e0e1b018b8e39689607 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 b4cb0d04f..17a16f2e1 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); }