@@ -219,12 +219,11 @@ impl eframe::App for MyApp {
219
219
|ui, row_range| {
220
220
for row in row_range {
221
221
let packet = self . data . raw_traffic [ row] . clone ( ) ;
222
- let color;
223
- if self . dark_mode {
224
- color = egui:: Color32 :: WHITE ;
222
+ let color = if self . dark_mode {
223
+ egui:: Color32 :: WHITE
225
224
} else {
226
- color = egui:: Color32 :: BLACK ;
227
- }
225
+ egui:: Color32 :: BLACK
226
+ } ;
228
227
ui. horizontal_wrapped ( |ui| {
229
228
let text;
230
229
if self . show_sent_cmds {
@@ -365,12 +364,11 @@ impl eframe::App for MyApp {
365
364
}
366
365
} ) ;
367
366
368
- let connect_text: & str ;
369
- if self . ready {
370
- connect_text = "Disconnect" ;
367
+ let connect_text = if self . ready {
368
+ "Disconnect"
371
369
} else {
372
- connect_text = "Connect" ;
373
- }
370
+ "Connect"
371
+ } ;
374
372
if ui. button ( connect_text) . clicked ( ) {
375
373
if let Ok ( mut write_guard) = self . device_lock . write ( ) {
376
374
if self . ready {
@@ -481,12 +479,11 @@ impl eframe::App for MyApp {
481
479
Print :: MESSAGE ( s) => {
482
480
let text = "[MSG] " . to_string ( ) ;
483
481
ui. horizontal_wrapped ( |ui| {
484
- let color: egui:: Color32 ;
485
- if self . dark_mode {
486
- color = egui:: Color32 :: WHITE ;
482
+ let color = if self . dark_mode {
483
+ egui:: Color32 :: WHITE
487
484
} else {
488
- color = egui:: Color32 :: BLACK ;
489
- }
485
+ egui:: Color32 :: BLACK
486
+ } ;
490
487
ui. label ( RichText :: new ( text) . color ( color) . font (
491
488
FontId :: new ( 14.0 , FontFamily :: Monospace ) ) ) ;
492
489
let text = format ! ( "{}" , s) ;
@@ -506,12 +503,11 @@ impl eframe::App for MyApp {
506
503
}
507
504
Print :: DEBUG ( s) => {
508
505
if self . gui_conf . debug {
509
- let color: egui:: Color32 ;
510
- if self . dark_mode {
511
- color = egui:: Color32 :: YELLOW ;
506
+ let color = if self . dark_mode {
507
+ egui:: Color32 :: YELLOW
512
508
} else {
513
- color = egui:: Color32 :: LIGHT_RED ;
514
- }
509
+ egui:: Color32 :: LIGHT_RED
510
+ } ;
515
511
ui. horizontal_wrapped ( |ui| {
516
512
let text = "[DBG] " . to_string ( ) ;
517
513
ui. label ( RichText :: new ( text) . color ( color) . font (
0 commit comments