diff --git a/tests/skip_debug/Cargo.toml b/tests/skip_debug/Cargo.toml index 430679691..7013b598e 100644 --- a/tests/skip_debug/Cargo.toml +++ b/tests/skip_debug/Cargo.toml @@ -13,5 +13,4 @@ prost = "0.13" tonic = { path = "../../tonic" } [build-dependencies] -prost-build = "0.13" tonic-build = { path = "../../tonic-build" } diff --git a/tests/skip_debug/build.rs b/tests/skip_debug/build.rs index b1846e2e7..68ca1cd47 100644 --- a/tests/skip_debug/build.rs +++ b/tests/skip_debug/build.rs @@ -1,26 +1,9 @@ fn main() { - let config = prost_build::Config::default(); tonic_build::configure() .skip_debug("test.Test") .skip_debug("test.Output") .build_client(true) .build_server(true) - .compile_protos_with_config(config, &["proto/test.proto"], &["proto"]) + .compile_protos(&["proto/test.proto"], &["proto"]) .unwrap(); - - // Add a dummy impl Debug to the skipped debug implementations to avoid missing impl Debug errors - let out = std::path::PathBuf::from(std::env::var("OUT_DIR").unwrap()); - let file_path = out.join("test.rs"); - let mut file_contents = std::fs::read_to_string(&file_path).unwrap(); - let debug_impl = r#" -impl std::fmt::Debug for Output { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - f.debug_struct("Output").finish() - } -} -"#; - file_contents.push_str(debug_impl); - - // Replace the original file with the modified content - std::fs::write(&file_path, file_contents).unwrap(); } diff --git a/tests/skip_debug/src/lib.rs b/tests/skip_debug/src/lib.rs index 9b06ad25c..46908f15d 100644 --- a/tests/skip_debug/src/lib.rs +++ b/tests/skip_debug/src/lib.rs @@ -1,3 +1,11 @@ pub mod pb { tonic::include_proto!("test"); + + // Add a dummy impl Debug to the skipped debug implementations to avoid + // missing impl Debug errors and check debug is not implemented for Output. + impl std::fmt::Debug for Output { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.debug_struct("Output").finish() + } + } }