Skip to content

Commit e3d9d53

Browse files
committed
Convert example to use eframe::egui::mutex::Mutex instead of std::sync::Mutex.
* std::sync::Mutex is disallowed by clippy config.
1 parent e4bdb1e commit e3d9d53

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

examples/file_dialog/src/file_picker.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
use eframe::egui::mutex::Mutex;
12
use std::path::PathBuf;
2-
use std::sync::{Arc, Mutex};
3+
use std::sync::Arc;
34

45
/// A file picker
56
/// * prevents multiple concurrent pick operations
@@ -33,7 +34,7 @@ impl Picker {
3334
std::thread::Builder::new()
3435
.name("picker".to_owned())
3536
.spawn(move || {
36-
let mut guard = picker.lock().unwrap();
37+
let mut guard = picker.lock();
3738
*guard = (
3839
true,
3940
rfd::FileDialog::new()
@@ -53,7 +54,7 @@ impl Picker {
5354

5455
let return_value = match &mut self.state {
5556
PickerState::Picking(arc) => {
56-
if let Ok(mut guard) = arc.try_lock() {
57+
if let Some(mut guard) = arc.try_lock() {
5758
match &mut *guard {
5859
(true, picked) => {
5960
was_picked = true;

0 commit comments

Comments
 (0)