Skip to content

Commit 72e68d0

Browse files
committed
Refactoring a bit
1 parent d0b6ed4 commit 72e68d0

File tree

1 file changed

+12
-7
lines changed
  • crates/ra_proc_macro/src

1 file changed

+12
-7
lines changed

crates/ra_proc_macro/src/lib.rs

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
//!
33
//! We separate proc-macro expanding logic to an extern program to allow
44
//! different implementations (e.g. wasm or dylib loading). And this crate
5-
//! is used for provide basic infra-structure for commnicate between two
6-
//! process: Client (RA itself), Server (the external program)
5+
//! is used to provide basic infrastructure for communication between two
6+
//! processes: Client (RA itself), Server (the external program)
77
88
use ra_mbe::ExpandError;
99
use ra_tt::Subtree;
@@ -18,7 +18,7 @@ trait ProcMacroExpander: std::fmt::Debug + Send + Sync + std::panic::RefUnwindSa
1818

1919
#[derive(Debug, Clone, PartialEq, Eq)]
2020
pub struct ProcMacroProcessExpander {
21-
process_path: PathBuf,
21+
process: Arc<ProcMacroProcessSrv>,
2222
}
2323

2424
impl ProcMacroExpander for ProcMacroProcessExpander {
@@ -34,7 +34,7 @@ impl ProcMacroExpander for ProcMacroProcessExpander {
3434

3535
#[derive(Debug, Clone)]
3636
pub struct ProcMacro {
37-
expander: Arc<Box<dyn ProcMacroExpander>>,
37+
expander: Arc<dyn ProcMacroExpander>,
3838
name: String,
3939
}
4040

@@ -55,16 +55,21 @@ impl ProcMacro {
5555
}
5656
}
5757

58+
#[derive(Debug, Clone, PartialEq, Eq)]
59+
pub struct ProcMacroProcessSrv {
60+
path: PathBuf,
61+
}
62+
5863
#[derive(Debug, Clone, PartialEq, Eq)]
5964
pub enum ProcMacroClient {
60-
Process { expander: Arc<ProcMacroProcessExpander> },
65+
Process { process: Arc<ProcMacroProcessSrv> },
6166
Dummy,
6267
}
6368

6469
impl ProcMacroClient {
6570
pub fn extern_process(process_path: &Path) -> ProcMacroClient {
66-
let expander = ProcMacroProcessExpander { process_path: process_path.into() };
67-
ProcMacroClient::Process { expander: Arc::new(expander) }
71+
let process = ProcMacroProcessSrv { path: process_path.into() };
72+
ProcMacroClient::Process { process: Arc::new(process) }
6873
}
6974

7075
pub fn dummy() -> ProcMacroClient {

0 commit comments

Comments
 (0)