Skip to content

Commit 7e59457

Browse files
committed
remove borrowed format macros and lifetime ellision clippy error Signed-off-by: Taddes <[email protected]>
1 parent 8da6c50 commit 7e59457

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

compiler/src/codegen.rs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -136,18 +136,18 @@ impl<'a> CodeWriter<'a> {
136136
}
137137

138138
pub fn field_entry(&mut self, name: &str, value: &str) {
139-
self.write_line(&format!("{name}: {value},"));
139+
self.write_line(format!("{name}: {value},"));
140140
}
141141

142142
pub fn field_decl(&mut self, name: &str, field_type: &str) {
143-
self.write_line(&format!("{name}: {field_type},"));
143+
self.write_line(format!("{name}: {field_type},"));
144144
}
145145

146146
pub fn comment(&mut self, comment: &str) {
147147
if comment.is_empty() {
148148
self.write_line("//");
149149
} else {
150-
self.write_line(&format!("// {comment}"));
150+
self.write_line(format!("// {comment}"));
151151
}
152152
}
153153

@@ -397,15 +397,15 @@ impl<'a> MethodGen<'a> {
397397
// Unary
398398
MethodType::Unary => {
399399
w.pub_fn(&self.unary_opt(&method_name), |w| {
400-
w.write_line(&format!(
400+
w.write_line(format!(
401401
"self.client.unary_call(&{}, req, opt)",
402402
self.const_method_name()
403403
));
404404
});
405405
w.write_line("");
406406

407407
w.pub_fn(&self.unary(&method_name), |w| {
408-
w.write_line(&format!(
408+
w.write_line(format!(
409409
"self.{}_opt(req, {})",
410410
method_name,
411411
fq_grpc("CallOption::default()")
@@ -414,15 +414,15 @@ impl<'a> MethodGen<'a> {
414414
w.write_line("");
415415

416416
w.pub_fn(&self.unary_async_opt(&method_name), |w| {
417-
w.write_line(&format!(
417+
w.write_line(format!(
418418
"self.client.unary_call_async(&{}, req, opt)",
419419
self.const_method_name()
420420
));
421421
});
422422
w.write_line("");
423423

424424
w.pub_fn(&self.unary_async(&method_name), |w| {
425-
w.write_line(&format!(
425+
w.write_line(format!(
426426
"self.{}_async_opt(req, {})",
427427
method_name,
428428
fq_grpc("CallOption::default()")
@@ -433,15 +433,15 @@ impl<'a> MethodGen<'a> {
433433
// Client streaming
434434
MethodType::ClientStreaming => {
435435
w.pub_fn(&self.client_streaming_opt(&method_name), |w| {
436-
w.write_line(&format!(
436+
w.write_line(format!(
437437
"self.client.client_streaming(&{}, opt)",
438438
self.const_method_name()
439439
));
440440
});
441441
w.write_line("");
442442

443443
w.pub_fn(&self.client_streaming(&method_name), |w| {
444-
w.write_line(&format!(
444+
w.write_line(format!(
445445
"self.{}_opt({})",
446446
method_name,
447447
fq_grpc("CallOption::default()")
@@ -452,15 +452,15 @@ impl<'a> MethodGen<'a> {
452452
// Server streaming
453453
MethodType::ServerStreaming => {
454454
w.pub_fn(&self.server_streaming_opt(&method_name), |w| {
455-
w.write_line(&format!(
455+
w.write_line(format!(
456456
"self.client.server_streaming(&{}, req, opt)",
457457
self.const_method_name()
458458
));
459459
});
460460
w.write_line("");
461461

462462
w.pub_fn(&self.server_streaming(&method_name), |w| {
463-
w.write_line(&format!(
463+
w.write_line(format!(
464464
"self.{}_opt(req, {})",
465465
method_name,
466466
fq_grpc("CallOption::default()")
@@ -471,15 +471,15 @@ impl<'a> MethodGen<'a> {
471471
// Duplex streaming
472472
MethodType::Duplex => {
473473
w.pub_fn(&self.duplex_streaming_opt(&method_name), |w| {
474-
w.write_line(&format!(
474+
w.write_line(format!(
475475
"self.client.duplex_streaming(&{}, opt)",
476476
self.const_method_name()
477477
));
478478
});
479479
w.write_line("");
480480

481481
w.pub_fn(&self.duplex_streaming(&method_name), |w| {
482-
w.write_line(&format!(
482+
w.write_line(format!(
483483
"self.{}_opt({})",
484484
method_name,
485485
fq_grpc("CallOption::default()")
@@ -526,7 +526,7 @@ impl<'a> MethodGen<'a> {
526526
),
527527
"});",
528528
|w| {
529-
w.write_line(&format!("instance.{}(ctx, req, resp)", self.name()));
529+
w.write_line(format!("instance.{}(ctx, req, resp)", self.name()));
530530
},
531531
);
532532
}

compiler/src/util.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ struct NameSpliter<'a> {
99
pos: usize,
1010
}
1111

12-
impl<'a> NameSpliter<'a> {
12+
impl NameSpliter<'_> {
1313
fn new(s: &str) -> NameSpliter {
1414
NameSpliter {
1515
name: s.as_bytes(),

0 commit comments

Comments
 (0)