Skip to content

Commit 2f002ad

Browse files
authored
Merge pull request #26 from lonesometraveler/clippy_18
Change Enum variant to CamelCase
2 parents 65ce8ec + 142327b commit 2f002ad

File tree

3 files changed

+19
-19
lines changed

3 files changed

+19
-19
lines changed

src/gui.rs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ const DEFAULT_FONT_ID: FontId = FontId::new(14.0, FontFamily::Monospace);
2020

2121
#[derive(Clone)]
2222
pub enum Print {
23-
EMPTY,
24-
MESSAGE(String),
25-
ERROR(String),
26-
DEBUG(String),
27-
TASK(String),
23+
Empty,
24+
Message(String),
25+
Error(String),
26+
Debug(String),
27+
Task(String),
2828
OK(String),
2929
}
3030

@@ -113,7 +113,7 @@ impl MyApp {
113113
picked_path: PathBuf::new(),
114114
device: "".to_string(),
115115
data: DataContainer::default(),
116-
console: vec![Print::MESSAGE(
116+
console: vec![Print::Message(
117117
"waiting for serial connection..,".to_owned(),
118118
)],
119119
connected_lock,
@@ -288,7 +288,7 @@ impl eframe::App for MyApp {
288288
Err(err) => {
289289
print_to_console(
290290
&self.print_lock,
291-
Print::ERROR(format!("send_tx thread send failed: {:?}", err)),
291+
Print::Error(format!("send_tx thread send failed: {:?}", err)),
292292
);
293293
}
294294
}
@@ -392,7 +392,7 @@ impl eframe::App for MyApp {
392392
Err(err) => {
393393
print_to_console(
394394
&self.print_lock,
395-
Print::ERROR(format!("clear_tx thread send failed: {:?}", err)),
395+
Print::Error(format!("clear_tx thread send failed: {:?}", err)),
396396
);
397397
}
398398
}
@@ -433,7 +433,7 @@ impl eframe::App for MyApp {
433433
Err(err) => {
434434
print_to_console(
435435
&self.print_lock,
436-
Print::ERROR(format!(
436+
Print::Error(format!(
437437
"save_tx thread send failed: {:?}",
438438
err
439439
)),
@@ -487,8 +487,8 @@ impl eframe::App for MyApp {
487487
.show_rows(ui, row_height, num_rows, |ui, row_range| {
488488
for row in row_range {
489489
match self.console[row].clone() {
490-
Print::EMPTY => {}
491-
Print::MESSAGE(s) => {
490+
Print::Empty => {}
491+
Print::Message(s) => {
492492
let text = "[MSG] ".to_string();
493493
ui.horizontal_wrapped(|ui| {
494494
let color = if self.dark_mode {
@@ -508,7 +508,7 @@ impl eframe::App for MyApp {
508508
);
509509
});
510510
}
511-
Print::ERROR(s) => {
511+
Print::Error(s) => {
512512
ui.horizontal_wrapped(|ui| {
513513
let text = "[ERR] ".to_string();
514514
ui.label(
@@ -523,7 +523,7 @@ impl eframe::App for MyApp {
523523
);
524524
});
525525
}
526-
Print::DEBUG(s) => {
526+
Print::Debug(s) => {
527527
if self.gui_conf.debug {
528528
let color = if self.dark_mode {
529529
egui::Color32::YELLOW
@@ -545,7 +545,7 @@ impl eframe::App for MyApp {
545545
});
546546
}
547547
}
548-
Print::TASK(s) => {
548+
Print::Task(s) => {
549549
ui.horizontal_wrapped(|ui| {
550550
let text = "[ ] ".to_string();
551551
ui.label(

src/main.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ fn main_thread(
9696
if let Ok(file_path) = save_rx.recv_timeout(Duration::from_millis(10)) {
9797
let print_index = print_to_console(
9898
&print_lock,
99-
Print::TASK(format!("saving data file to {:?} ...", file_path)),
99+
Print::Task(format!("saving data file to {:?} ...", file_path)),
100100
);
101101
match save_to_csv(&data, &file_path) {
102102
Ok(_) => {
@@ -109,7 +109,7 @@ fn main_thread(
109109
Err(e) => {
110110
print_to_console(
111111
&print_lock,
112-
Print::ERROR(format!("failed to save file: {e:?}")),
112+
Print::Error(format!("failed to save file: {e:?}")),
113113
);
114114
}
115115
}
@@ -142,7 +142,7 @@ fn main() {
142142
let baud_lock = Arc::new(RwLock::new(gui_settings.baud));
143143
let raw_data_lock = Arc::new(RwLock::new(vec![Packet::default()]));
144144
let data_lock = Arc::new(RwLock::new(DataContainer::default()));
145-
let print_lock = Arc::new(RwLock::new(vec![Print::EMPTY]));
145+
let print_lock = Arc::new(RwLock::new(vec![Print::Empty]));
146146
let connected_lock = Arc::new(RwLock::new(false));
147147

148148
let (save_tx, save_rx): (Sender<PathBuf>, Receiver<PathBuf>) = mpsc::channel();

src/serial.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ pub fn serial_thread(
9393
device = "".to_string();
9494
print_to_console(
9595
&print_lock,
96-
Print::ERROR(format!("Error connecting: {}", err)),
96+
Print::Error(format!("Error connecting: {}", err)),
9797
);
9898
continue;
9999
}
@@ -151,7 +151,7 @@ pub fn serial_thread(
151151
if reconnect || !dev_is_con {
152152
print_to_console(
153153
&print_lock,
154-
Print::ERROR(format!("disconnected from serial port: {}", device)),
154+
Print::Error(format!("disconnected from serial port: {}", device)),
155155
);
156156
if let Ok(mut write_guard) = device_lock.write() {
157157
*write_guard = "".to_string();

0 commit comments

Comments
 (0)