From 4e6c0cefb6c21183725bea4924b456c4002e6024 Mon Sep 17 00:00:00 2001 From: Mitchell Kember Date: Thu, 11 Jan 2024 01:16:03 +0000 Subject: [PATCH] [fidl][rust] Put #[allow(dead_code)] on empty services Since https://github.com/rust-lang/rust/pull/118297, Rust treats unused tuple struct fields as dead code. This CL adds an #[allow(dead_code)] to silence the warning. Bug: 318827209 Change-Id: I6858165a085a0ef508722c1ce38f3d95866d2867 Reviewed-on: https://fuchsia-review.googlesource.com/c/fuchsia/+/972128 Reviewed-by: David Koloski Commit-Queue: Auto-Submit Fuchsia-Auto-Submit: Mitchell Kember --- tools/fidl/fidlgen_rust/codegen/service.tmpl | 2 +- tools/fidl/fidlgen_rust/goldens/service.rs.golden | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/fidl/fidlgen_rust/codegen/service.tmpl b/tools/fidl/fidlgen_rust/codegen/service.tmpl index 59026a20eb6..8d815697dd5 100644 --- a/tools/fidl/fidlgen_rust/codegen/service.tmpl +++ b/tools/fidl/fidlgen_rust/codegen/service.tmpl @@ -58,7 +58,7 @@ impl fidl::endpoints::ServiceRequest for {{ .Name }}Request { ///{{ . }} {{- end }} #[cfg(target_os = "fuchsia")] -pub struct {{ .Name }}Proxy(Box); +pub struct {{ .Name }}Proxy({{ if not .Members }}#[allow(dead_code)] {{ end }}Box); #[cfg(target_os = "fuchsia")] impl fidl::endpoints::ServiceProxy for {{ .Name }}Proxy { diff --git a/tools/fidl/fidlgen_rust/goldens/service.rs.golden b/tools/fidl/fidlgen_rust/goldens/service.rs.golden index 7ceec2b7068..793aa1291a6 100644 --- a/tools/fidl/fidlgen_rust/goldens/service.rs.golden +++ b/tools/fidl/fidlgen_rust/goldens/service.rs.golden @@ -656,7 +656,7 @@ impl fidl::endpoints::ServiceRequest for EmptyServiceRequest { } } #[cfg(target_os = "fuchsia")] -pub struct EmptyServiceProxy(Box); +pub struct EmptyServiceProxy(#[allow(dead_code)] Box); #[cfg(target_os = "fuchsia")] impl fidl::endpoints::ServiceProxy for EmptyServiceProxy {