mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-23 16:52:34 +00:00
Properly clean proc-macro-srv proc-macro temp dir
This commit is contained in:
parent
4d5bb86ad7
commit
a7a365e8f8
8 changed files with 125 additions and 18 deletions
|
|
@ -39,6 +39,7 @@ fn main() -> std::io::Result<()> {
|
|||
#[derive(Copy, Clone)]
|
||||
enum ProtocolFormat {
|
||||
Json,
|
||||
#[cfg(feature = "postcard")]
|
||||
Postcard,
|
||||
}
|
||||
|
||||
|
|
@ -50,12 +51,14 @@ impl ValueEnum for ProtocolFormat {
|
|||
fn to_possible_value(&self) -> Option<clap::builder::PossibleValue> {
|
||||
match self {
|
||||
ProtocolFormat::Json => Some(clap::builder::PossibleValue::new("json")),
|
||||
#[cfg(feature = "postcard")]
|
||||
ProtocolFormat::Postcard => Some(clap::builder::PossibleValue::new("postcard")),
|
||||
}
|
||||
}
|
||||
fn from_str(input: &str, _ignore_case: bool) -> Result<Self, String> {
|
||||
match input {
|
||||
"json" => Ok(ProtocolFormat::Json),
|
||||
#[cfg(feature = "postcard")]
|
||||
"postcard" => Ok(ProtocolFormat::Postcard),
|
||||
_ => Err(format!("unknown protocol format: {input}")),
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ impl SpanTransformer for SpanTrans {
|
|||
pub(crate) fn run(format: ProtocolFormat) -> io::Result<()> {
|
||||
match format {
|
||||
ProtocolFormat::Json => run_json(),
|
||||
#[cfg(feature = "postcard")]
|
||||
ProtocolFormat::Postcard => unimplemented!(),
|
||||
}
|
||||
}
|
||||
|
|
@ -96,7 +97,7 @@ fn run_json() -> io::Result<()> {
|
|||
|
||||
srv.expand(
|
||||
lib,
|
||||
env,
|
||||
&env,
|
||||
current_dir,
|
||||
macro_name,
|
||||
macro_body,
|
||||
|
|
@ -127,7 +128,7 @@ fn run_json() -> io::Result<()> {
|
|||
});
|
||||
srv.expand(
|
||||
lib,
|
||||
env,
|
||||
&env,
|
||||
current_dir,
|
||||
macro_name,
|
||||
macro_body,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue