From 3a8fdbe6cd026e1a2dc229913c51a3c4815ca548 Mon Sep 17 00:00:00 2001 From: Trisha Date: Tue, 19 Oct 2021 11:19:01 -0500 Subject: [PATCH] :recycle: refactor: extract MAX_PORTS --- prototypes/ptth_quic_client_gui/src/main.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/prototypes/ptth_quic_client_gui/src/main.rs b/prototypes/ptth_quic_client_gui/src/main.rs index 077f60a..4dba9b9 100644 --- a/prototypes/ptth_quic_client_gui/src/main.rs +++ b/prototypes/ptth_quic_client_gui/src/main.rs @@ -136,7 +136,9 @@ impl GuiClient <'_> { ports_col: &mut Flex, fltk_tx: fltk::app::Sender ) { - if self.ports.len () >= 5 { + const MAX_PORTS: usize = 5; + + if self.ports.len () >= MAX_PORTS { return; } @@ -151,7 +153,7 @@ impl GuiClient <'_> { self.ports.push (port); - if self.ports.len () >= 5 { + if self.ports.len () >= MAX_PORTS { self.but_add_port.deactivate (); } }