@@ -271,23 +271,18 @@ impl<'a> MethodGen<'a> {
271271
272272 fn write_client ( & self , w : & mut CodeWriter ) {
273273 let method_name = self . name ( ) ;
274- match self . method_type ( ) . 0 {
275- // Unary
276- MethodType :: Unary => {
277- w. pub_fn ( & self . unary ( & method_name) , |w| {
278- w. write_line ( & format ! ( "let mut cres = {}::new();" , self . output( ) ) ) ;
279- w. write_line ( & format ! (
280- "::ttrpc::client_request!(self, ctx, req, \" {}.{}\" , \" {}\" , cres);" ,
281- self . package_name,
282- self . service_name,
283- & self . proto. get_name( ) ,
284- ) ) ;
285- w. write_line ( "Ok(cres)" ) ;
286- } ) ;
287- }
288-
289- _ => { }
290- } ;
274+ if let MethodType :: Unary = self . method_type ( ) . 0 {
275+ w. pub_fn ( & self . unary ( & method_name) , |w| {
276+ w. write_line ( & format ! ( "let mut cres = {}::new();" , self . output( ) ) ) ;
277+ w. write_line ( & format ! (
278+ "::ttrpc::client_request!(self, ctx, req, \" {}.{}\" , \" {}\" , cres);" ,
279+ self . package_name,
280+ self . service_name,
281+ & self . proto. get_name( ) ,
282+ ) ) ;
283+ w. write_line ( "Ok(cres)" ) ;
284+ } ) ;
285+ }
291286 }
292287
293288 fn write_async_client ( & self , w : & mut CodeWriter ) {
@@ -456,7 +451,7 @@ impl<'a> ServiceGen<'a> {
456451 file. get_package ( ) . to_string ( ) ,
457452 util:: to_camel_case ( proto. get_name ( ) ) ,
458453 root_scope,
459- & customize,
454+ customize,
460455 )
461456 } )
462457 . collect ( ) ;
@@ -546,7 +541,7 @@ impl<'a> ServiceGen<'a> {
546541 trait_name = format ! ( "{}: Sync" , & self . service_name( ) ) ;
547542 }
548543
549- w. pub_trait ( & trait_name. to_owned ( ) , |w| {
544+ w. pub_trait ( & trait_name, |w| {
550545 for method in & self . methods {
551546 method. write_service ( w) ;
552547 }
@@ -767,8 +762,8 @@ where
767762{
768763 let req = CodeGeneratorRequest :: parse_from_reader ( & mut stdin ( ) ) . unwrap ( ) ;
769764 let result = gen ( & GenRequest {
770- file_descriptors : & req. get_proto_file ( ) ,
771- files_to_generate : & req. get_file_to_generate ( ) ,
765+ file_descriptors : req. get_proto_file ( ) ,
766+ files_to_generate : req. get_file_to_generate ( ) ,
772767 parameter : req. get_parameter ( ) ,
773768 } ) ;
774769 let mut resp = CodeGeneratorResponse :: new ( ) ;
0 commit comments