Skip to content

Commit b72751b

Browse files
authored
Merge pull request #10 from lonesometraveler/clippy_8
Replace match with a single arm with if let.
2 parents 281f98b + 8a07a20 commit b72751b

File tree

1 file changed

+7
-13
lines changed

1 file changed

+7
-13
lines changed

src/main.rs

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -71,14 +71,11 @@ fn main_thread(data_lock: Arc<RwLock<DataContainer>>,
7171
let mut data = DataContainer::default();
7272
let mut failed_format_counter = 0;
7373
loop {
74-
match clear_rx.recv_timeout(Duration::from_millis(10)) {
75-
Ok(cl) => {
76-
if cl {
77-
data = DataContainer::default();
78-
failed_format_counter = 0;
79-
}
74+
if let Ok(cl) = clear_rx.recv_timeout(Duration::from_millis(10)) {
75+
if cl {
76+
data = DataContainer::default();
77+
failed_format_counter = 0;
8078
}
81-
Err(..) => ()
8279
}
8380
if let Ok(read_guard) = raw_data_lock.read() {
8481
let packets = read_guard.clone();
@@ -132,12 +129,9 @@ fn main_thread(data_lock: Arc<RwLock<DataContainer>>,
132129
*write_guard = vec![Packet::default()];
133130
}
134131

135-
match save_rx.recv_timeout(Duration::from_millis(10)) {
136-
Ok(fp) => {
137-
file_path = fp;
138-
acquire = true
139-
}
140-
Err(..) => ()
132+
if let Ok(fp) = save_rx.recv_timeout(Duration::from_millis(10)) {
133+
file_path = fp;
134+
acquire = true;
141135
}
142136

143137
if acquire == true {

0 commit comments

Comments
 (0)