Skip to content

Commit fe0ea53

Browse files
committed
compiler: write_sync_server_create: Fix no methds warn
If sync server doesn't have any methods, the generated code will get warn. This commit adds check to not add "mnt" to handle this issue. Fixes: #273 Signed-off-by: Hui Zhu <teawater@antgroup.com>
1 parent 9cffd32 commit fe0ea53

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

compiler/src/codegen.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -574,8 +574,13 @@ impl<'a> ServiceGen<'a> {
574574
method_handler_name,
575575
);
576576

577+
let has_normal_method = self.has_normal_method();
577578
w.pub_fn(&s, |w| {
578-
w.write_line("let mut methods = HashMap::new();");
579+
if has_normal_method {
580+
w.write_line("let mut methods = HashMap::new();");
581+
} else {
582+
w.write_line("let methods = HashMap::new();");
583+
}
579584
for method in &self.methods[0..self.methods.len()] {
580585
w.write_line("");
581586
method.write_bind(w);

0 commit comments

Comments
 (0)