Skip to content

Commit 1d3776a

Browse files
committed
Fixed cargo clippy errors.
1 parent 0655a42 commit 1d3776a

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

serial_term/src/main.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
use crate::egui::Color32;
22
use crate::egui::RichText;
33
use eframe::egui;
4-
use serialport;
54
use std::string::String;
65

76
#[derive(Default)]
@@ -17,11 +16,11 @@ impl SerialAppCore {
1716
// assert port_name not empty.
1817
let serial_port_builder = serialport::new(port_name, baud_rate);
1918
let serial_port_err_code = serial_port_builder.open();
20-
if serial_port_err_code.is_ok() {
21-
self.serial_port = Some(serial_port_err_code.unwrap());
19+
if let Ok(serial_port) = serial_port_err_code {
20+
self.serial_port = Some(serial_port);
2221
return Ok(());
2322
}
24-
return Err(serial_port_err_code.err().unwrap().description);
23+
Err(serial_port_err_code.err().unwrap().description)
2524
}
2625
}
2726

@@ -83,9 +82,9 @@ impl eframe::App for SerialAppCore {
8382

8483
fn main() {
8584
let options = eframe::NativeOptions::default();
86-
eframe::run_native(
85+
let _error_code = eframe::run_native(
8786
"Serial Monitor",
8887
options,
89-
Box::new(|_cc| Box::new(SerialAppCore::default())),
88+
Box::new(|_cc| Box::<SerialAppCore>::default()),
9089
);
9190
}

0 commit comments

Comments
 (0)