This is an automated email from the ASF dual-hosted git repository.

jking pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/thrift.git


The following commit(s) were added to refs/heads/master by this push:
     new d5bd200  THRIFT-4661: Rust enum name wrong case in generated structs
d5bd200 is described below

commit d5bd2005eac7fa4912b60b3a815596c67a348afb
Author: jake-ruyi <[email protected]>
AuthorDate: Wed Nov 7 16:16:27 2018 +0800

    THRIFT-4661: Rust enum name wrong case in generated structs
    
    Client: rs
---
 compiler/cpp/src/thrift/generate/t_rs_generator.cc | 2 +-
 lib/rs/test/src/bin/kitchen_sink_server.rs         | 4 ++--
 lib/rs/test/thrifts/Base_Two.thrift                | 6 ++++++
 3 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/compiler/cpp/src/thrift/generate/t_rs_generator.cc 
b/compiler/cpp/src/thrift/generate/t_rs_generator.cc
index dc11fd3..5cd67f6 100644
--- a/compiler/cpp/src/thrift/generate/t_rs_generator.cc
+++ b/compiler/cpp/src/thrift/generate/t_rs_generator.cc
@@ -3022,7 +3022,7 @@ string t_rs_generator::to_rust_type(t_type* ttype, bool 
ordered_float) {
     rust_type =  ttypedef->is_forward_typedef() ? "Box<" + rust_type + ">" : 
rust_type;
     return rust_type;
   } else if (ttype->is_enum()) {
-    return rust_namespace(ttype) + ttype->get_name();
+    return rust_namespace(ttype) + rust_camel_case(ttype->get_name());
   } else if (ttype->is_struct() || ttype->is_xception()) {
     return rust_namespace(ttype) + rust_camel_case(ttype->get_name());
   } else if (ttype->is_map()) {
diff --git a/lib/rs/test/src/bin/kitchen_sink_server.rs 
b/lib/rs/test/src/bin/kitchen_sink_server.rs
index 15ceb29..ae70262 100644
--- a/lib/rs/test/src/bin/kitchen_sink_server.rs
+++ b/lib/rs/test/src/bin/kitchen_sink_server.rs
@@ -22,7 +22,7 @@ extern crate kitchen_sink;
 extern crate thrift;
 
 use kitchen_sink::base_one::Noodle;
-use kitchen_sink::base_two::{Napkin, NapkinServiceSyncHandler, Ramen, 
RamenServiceSyncHandler};
+use kitchen_sink::base_two::{BrothType, Napkin, NapkinServiceSyncHandler, 
Ramen, RamenServiceSyncHandler};
 use kitchen_sink::midlayer::{Dessert, Meal, MealServiceSyncHandler, 
MealServiceSyncProcessor};
 use kitchen_sink::recursive;
 use kitchen_sink::ultimate::{Drink, FullMeal, FullMealAndDrinks,
@@ -252,7 +252,7 @@ fn noodle() -> Noodle {
 }
 
 fn ramen() -> Ramen {
-    Ramen::new("Mr Ramen".to_owned(), 72)
+    Ramen::new("Mr Ramen".to_owned(), 72, BrothType::MISO)
 }
 
 fn napkin() -> Napkin {
diff --git a/lib/rs/test/thrifts/Base_Two.thrift 
b/lib/rs/test/thrifts/Base_Two.thrift
index b4b4ea1..caa6acb 100644
--- a/lib/rs/test/thrifts/Base_Two.thrift
+++ b/lib/rs/test/thrifts/Base_Two.thrift
@@ -23,9 +23,15 @@
 
 const i32 WaterWeight = 200
 
+enum brothType {
+  Miso,
+  shouyu,
+}
+
 struct Ramen {
   1: optional string ramenType
   2: required i32 noodleCount
+  3: brothType broth
 }
 
 struct Napkin {

Reply via email to