From 0483cef86e577d619ba229466e60c43691f33924 Mon Sep 17 00:00:00 2001 From: Lucio Franco Date: Wed, 23 Oct 2019 14:52:20 -0400 Subject: [PATCH] fix(build): Fix service and rpc name conflict Closes #89 --- tonic-build/src/server.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tonic-build/src/server.rs b/tonic-build/src/server.rs index d19f45a7d..92295e91d 100644 --- a/tonic-build/src/server.rs +++ b/tonic-build/src/server.rs @@ -223,7 +223,7 @@ fn generate_unary( proto_path: &str, server_trait: Ident, ) -> TokenStream { - let service_ident = Ident::new(&method.proto_name, Span::call_site()); + let service_ident = quote::format_ident!("{}Svc", method.proto_name); let (request, response) = crate::replace_wellknown(proto_path, &method); @@ -262,7 +262,7 @@ fn generate_server_streaming( proto_path: &str, server_trait: Ident, ) -> TokenStream { - let service_ident = Ident::new(&method.proto_name, Span::call_site()); + let service_ident = quote::format_ident!("{}Svc", method.proto_name); let (request, response) = crate::replace_wellknown(proto_path, &method); @@ -305,7 +305,7 @@ fn generate_client_streaming( proto_path: &str, server_trait: Ident, ) -> TokenStream { - let service_ident = Ident::new(&method.proto_name, Span::call_site()); + let service_ident = quote::format_ident!("{}Svc", method.proto_name); let (request, response) = crate::replace_wellknown(proto_path, &method); @@ -346,7 +346,7 @@ fn generate_streaming( proto_path: &str, server_trait: Ident, ) -> TokenStream { - let service_ident = Ident::new(&method.proto_name, Span::call_site()); + let service_ident = quote::format_ident!("{}Svc", method.proto_name); let (request, response) = crate::replace_wellknown(proto_path, &method);