Properly clean proc-macro-srv proc-macro temp dir

This commit is contained in:
Lukas Wirth 2025-07-31 09:26:05 +02:00
parent 4d5bb86ad7
commit a7a365e8f8
8 changed files with 125 additions and 18 deletions

View file

@ -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}")),
}

View file

@ -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,