Skip to content

Commit c50d9f3

Browse files
Remove unnecessary Option
1 parent b988c6f commit c50d9f3

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

crates/proc_macro_api/src/process.rs

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use crate::{
1919

2020
#[derive(Debug, Default)]
2121
pub(crate) struct ProcMacroProcessSrv {
22-
inner: Option<Weak<Sender<Task>>>,
22+
inner: Weak<Sender<Task>>,
2323
}
2424

2525
#[derive(Debug)]
@@ -42,7 +42,7 @@ impl ProcMacroProcessSrv {
4242
});
4343

4444
let task_tx = Arc::new(task_tx);
45-
let srv = ProcMacroProcessSrv { inner: Some(Arc::downgrade(&task_tx)) };
45+
let srv = ProcMacroProcessSrv { inner: Arc::downgrade(&task_tx) };
4646
let thread = ProcMacroProcessThread { handle, sender: task_tx };
4747

4848
Ok((thread, srv))
@@ -79,13 +79,8 @@ impl ProcMacroProcessSrv {
7979
where
8080
R: TryFrom<Response, Error = &'static str>,
8181
{
82-
let sender = match &self.inner {
83-
None => return Err(tt::ExpansionError::Unknown("No sender is found.".to_string())),
84-
Some(it) => it,
85-
};
86-
8782
let (result_tx, result_rx) = bounded(0);
88-
let sender = match sender.upgrade() {
83+
let sender = match self.inner.upgrade() {
8984
None => {
9085
return Err(tt::ExpansionError::Unknown("Proc macro process is closed.".into()))
9186
}

0 commit comments

Comments
 (0)