Skip to content

Commit

Permalink
Formatting fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
PolyMeilex committed Nov 23, 2024
1 parent 2787c56 commit 3d09f55
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 21 deletions.
1 change: 0 additions & 1 deletion examples/msg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,3 @@ fn main() {
stdin.read_to_end(&mut buffer).unwrap();
println!();
}

18 changes: 10 additions & 8 deletions src/backend/macos/message_dialog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use crate::message_dialog::{MessageButtons, MessageDialog, MessageDialogResult,
use super::modal_future::AsModal;
use super::{
modal_future::{InnerModal, ModalFuture},
utils::{run_on_main, FocusManager, PolicyManager, self},
utils::{self, run_on_main, FocusManager, PolicyManager},
};

use super::utils::window_from_raw_window_handle;
Expand Down Expand Up @@ -155,13 +155,15 @@ impl InnerModal for NSAlert {
use crate::backend::MessageDialogImpl;
impl MessageDialogImpl for MessageDialog {
fn show(self) -> MessageDialogResult {
autoreleasepool(move |_| run_on_main(move |mtm| {
if self.parent.is_none() {
utils::sync_pop_dialog(self, mtm)
} else {
Alert::new(self, mtm).run()
}
}))
autoreleasepool(move |_| {
run_on_main(move |mtm| {
if self.parent.is_none() {
utils::sync_pop_dialog(self, mtm)
} else {
Alert::new(self, mtm).run()
}
})
})
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/backend/macos/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ mod user_alert;

pub use focus_manager::FocusManager;
pub use policy_manager::PolicyManager;
pub use user_alert::{ async_pop_dialog, sync_pop_dialog };
pub use user_alert::{async_pop_dialog, sync_pop_dialog};

use objc2::rc::Id;
use objc2_app_kit::{NSApplication, NSView, NSWindow};
Expand Down
1 change: 0 additions & 1 deletion src/backend/macos/utils/user_alert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -199,4 +199,3 @@ pub fn async_pop_dialog(opt: MessageDialog) -> DialogFutureType<MessageDialogRes
}
})
}

14 changes: 6 additions & 8 deletions src/backend/win_cid/thread_future.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,13 @@ impl<R> std::future::Future for ThreadFuture<R> {
let data = state.data.try_lock();

match data {
Ok(mut data) => {
match data.take() {
Some(data) => Poll::Ready(data),
None => {
*state.waker.lock().unwrap() = Some(cx.waker().clone());
Poll::Pending
}
Ok(mut data) => match data.take() {
Some(data) => Poll::Ready(data),
None => {
*state.waker.lock().unwrap() = Some(cx.waker().clone());
Poll::Pending
}
}
},
Err(TryLockError::Poisoned(err)) => {
panic!("{}", err);
}
Expand Down
7 changes: 5 additions & 2 deletions src/oneshot.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
use std::fmt;
use std::pin::Pin;
use std::future::Future;
use std::sync::{Mutex, Arc, atomic::{AtomicBool, Ordering::SeqCst}};
use std::pin::Pin;
use std::sync::{
atomic::{AtomicBool, Ordering::SeqCst},
Arc, Mutex,
};
use std::task::{Context, Poll, Waker};

#[must_use = "futures do nothing unless you `.await` or poll them"]
Expand Down

0 comments on commit 3d09f55

Please sign in to comment.