Skip to content

Commit ff13dea

Browse files
committed
compiler: Fix clippy warnings on rust 1.81.0
Fix warnings. Signed-off-by: Tim Zhang <tim@hyper.sh>
1 parent 399142c commit ff13dea

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

compiler/src/codegen.rs

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ impl<'a> MethodGen<'a> {
148148
&format!("struct {}Method {{", self.struct_name()),
149149
"}",
150150
|w| {
151-
w.write_line(&format!(
151+
w.write_line(format!(
152152
"service: Arc<dyn {} + Send + Sync>,",
153153
self.service_name
154154
));
@@ -167,7 +167,7 @@ impl<'a> MethodGen<'a> {
167167
|w| {
168168
w.block("fn handler(&self, ctx: ::ttrpc::TtrpcContext, req: ::ttrpc::Request) -> ::ttrpc::Result<()> {", "}",
169169
|w| {
170-
w.write_line(&format!("::ttrpc::request_handler!(self, ctx, req, {}, {}, {});",
170+
w.write_line(format!("::ttrpc::request_handler!(self, ctx, req, {}, {}, {});",
171171
proto_path_to_rust_mod(self.root_scope.find_message(self.proto.get_input_type()).get_scope().get_file_descriptor().get_name()),
172172
self.root_scope.find_message(self.proto.get_input_type()).rust_name(),
173173
self.name()));
@@ -184,7 +184,7 @@ impl<'a> MethodGen<'a> {
184184
|w| {
185185
w.block("async fn handler(&self, ctx: ::ttrpc::r#async::TtrpcContext, req: ::ttrpc::Request) -> ::ttrpc::Result<::ttrpc::Response> {", "}",
186186
|w| {
187-
w.write_line(&format!("::ttrpc::async_request_handler!(self, ctx, req, {}, {}, {});",
187+
w.write_line(format!("::ttrpc::async_request_handler!(self, ctx, req, {}, {}, {});",
188188
proto_path_to_rust_mod(self.root_scope.find_message(self.proto.get_input_type()).get_scope().get_file_descriptor().get_name()),
189189
self.root_scope.find_message(self.proto.get_input_type()).rust_name(),
190190
self.name()));
@@ -197,7 +197,7 @@ impl<'a> MethodGen<'a> {
197197
|w| {
198198
w.block("async fn handler(&self, ctx: ::ttrpc::r#async::TtrpcContext, inner: ::ttrpc::r#async::StreamInner) -> ::ttrpc::Result<Option<::ttrpc::Response>> {", "}",
199199
|w| {
200-
w.write_line(&format!("::ttrpc::async_client_streamimg_handler!(self, ctx, inner, {});",
200+
w.write_line(format!("::ttrpc::async_client_streamimg_handler!(self, ctx, inner, {});",
201201
self.name()));
202202
});
203203
});
@@ -208,7 +208,7 @@ impl<'a> MethodGen<'a> {
208208
|w| {
209209
w.block("async fn handler(&self, ctx: ::ttrpc::r#async::TtrpcContext, mut inner: ::ttrpc::r#async::StreamInner) -> ::ttrpc::Result<Option<::ttrpc::Response>> {", "}",
210210
|w| {
211-
w.write_line(&format!("::ttrpc::async_server_streamimg_handler!(self, ctx, inner, {}, {}, {});",
211+
w.write_line(format!("::ttrpc::async_server_streamimg_handler!(self, ctx, inner, {}, {}, {});",
212212
proto_path_to_rust_mod(self.root_scope.find_message(self.proto.get_input_type()).get_scope().get_file_descriptor().get_name()),
213213
self.root_scope.find_message(self.proto.get_input_type()).rust_name(),
214214
self.name()));
@@ -221,7 +221,7 @@ impl<'a> MethodGen<'a> {
221221
|w| {
222222
w.block("async fn handler(&self, ctx: ::ttrpc::r#async::TtrpcContext, inner: ::ttrpc::r#async::StreamInner) -> ::ttrpc::Result<Option<::ttrpc::Response>> {", "}",
223223
|w| {
224-
w.write_line(&format!("::ttrpc::async_duplex_streamimg_handler!(self, ctx, inner, {});",
224+
w.write_line(format!("::ttrpc::async_duplex_streamimg_handler!(self, ctx, inner, {});",
225225
self.name()));
226226
});
227227
});
@@ -277,8 +277,8 @@ impl<'a> MethodGen<'a> {
277277
let method_name = self.name();
278278
if let MethodType::Unary = self.method_type().0 {
279279
w.pub_fn(&self.unary(&method_name), |w| {
280-
w.write_line(&format!("let mut cres = {}::new();", self.output()));
281-
w.write_line(&format!(
280+
w.write_line(format!("let mut cres = {}::new();", self.output()));
281+
w.write_line(format!(
282282
"::ttrpc::client_request!(self, ctx, req, \"{}.{}\", \"{}\", cres);",
283283
self.package_name,
284284
self.service_name,
@@ -295,8 +295,8 @@ impl<'a> MethodGen<'a> {
295295
// Unary RPC
296296
MethodType::Unary => {
297297
pub_async_fn(w, &self.unary(&method_name), |w| {
298-
w.write_line(&format!("let mut cres = {}::new();", self.output()));
299-
w.write_line(&format!(
298+
w.write_line(format!("let mut cres = {}::new();", self.output()));
299+
w.write_line(format!(
300300
"::ttrpc::async_client_request!(self, ctx, req, \"{}.{}\", \"{}\", cres);",
301301
self.package_name,
302302
self.service_name,
@@ -307,7 +307,7 @@ impl<'a> MethodGen<'a> {
307307
// Client Streaming RPC
308308
MethodType::ClientStreaming => {
309309
pub_async_fn(w, &self.client_streaming(&method_name), |w| {
310-
w.write_line(&format!(
310+
w.write_line(format!(
311311
"::ttrpc::async_client_stream_send!(self, ctx, \"{}.{}\", \"{}\");",
312312
self.package_name,
313313
self.service_name,
@@ -318,7 +318,7 @@ impl<'a> MethodGen<'a> {
318318
// Server Streaming RPC
319319
MethodType::ServerStreaming => {
320320
pub_async_fn(w, &self.server_streaming(&method_name), |w| {
321-
w.write_line(&format!(
321+
w.write_line(format!(
322322
"::ttrpc::async_client_stream_receive!(self, ctx, req, \"{}.{}\", \"{}\");",
323323
self.package_name,
324324
self.service_name,
@@ -329,7 +329,7 @@ impl<'a> MethodGen<'a> {
329329
// Bidirectional streaming RPC
330330
MethodType::Duplex => {
331331
pub_async_fn(w, &self.duplex_streaming(&method_name), |w| {
332-
w.write_line(&format!(
332+
w.write_line(format!(
333333
"::ttrpc::async_client_stream!(self, ctx, \"{}.{}\", \"{}\");",
334334
self.package_name,
335335
self.service_name,
@@ -496,13 +496,13 @@ impl<'a> ServiceGen<'a> {
496496

497497
fn write_sync_client(&self, w: &mut CodeWriter) {
498498
w.write_line("#[derive(Clone)]");
499-
w.pub_struct(&self.client_name(), |w| {
499+
w.pub_struct(self.client_name(), |w| {
500500
w.field_decl("client", "::ttrpc::Client");
501501
});
502502

503503
w.write_line("");
504504

505-
w.impl_self_block(&self.client_name(), |w| {
505+
w.impl_self_block(self.client_name(), |w| {
506506
w.pub_fn("new(client: ::ttrpc::Client) -> Self", |w| {
507507
w.expr_block(&self.client_name(), |w| {
508508
w.write_line("client,");
@@ -518,13 +518,13 @@ impl<'a> ServiceGen<'a> {
518518

519519
fn write_async_client(&self, w: &mut CodeWriter) {
520520
w.write_line("#[derive(Clone)]");
521-
w.pub_struct(&self.client_name(), |w| {
521+
w.pub_struct(self.client_name(), |w| {
522522
w.field_decl("client", "::ttrpc::r#async::Client");
523523
});
524524

525525
w.write_line("");
526526

527-
w.impl_self_block(&self.client_name(), |w| {
527+
w.impl_self_block(self.client_name(), |w| {
528528
w.pub_fn("new(client: ::ttrpc::r#async::Client) -> Self", |w| {
529529
w.expr_block(&self.client_name(), |w| {
530530
w.write_line("client,");

0 commit comments

Comments
 (0)