mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-03-15 11:59:16 +01:00
cln-rpc: Allow access to deprecated fields in conversions
This silences a compilation warning about accessing a deprecated field. This was triggering on each build and we'll notice when they go away, so why upset users with it?
This commit is contained in:
parent
557cd183ac
commit
53b37ca1c1
2 changed files with 229 additions and 218 deletions
432
cln-grpc/src/convert.rs
generated
432
cln-grpc/src/convert.rs
generated
File diff suppressed because it is too large
Load diff
|
@ -247,9 +247,17 @@ class GrpcConverterGenerator(IGenerator):
|
|||
self.generate_composite(prefix, f)
|
||||
|
||||
pbname = self.to_camel_case(field.typename)
|
||||
|
||||
# If any of the field accesses would result in a deprecated
|
||||
# warning we mark the construction here to allow deprecated
|
||||
# fields being access.
|
||||
|
||||
has_deprecated = any([f.deprecated for f in field.fields])
|
||||
deprecated = ",deprecated" if has_deprecated else ""
|
||||
|
||||
# And now we can convert the current field:
|
||||
self.write(f"""\
|
||||
#[allow(unused_variables,deprecated)]
|
||||
#[allow(unused_variables{deprecated})]
|
||||
impl From<{prefix}::{field.typename}> for pb::{pbname} {{
|
||||
fn from(c: {prefix}::{field.typename}) -> Self {{
|
||||
Self {{
|
||||
|
@ -406,10 +414,13 @@ class GrpcUnconverterGenerator(GrpcConverterGenerator):
|
|||
elif isinstance(f, CompositeField):
|
||||
self.generate_composite(prefix, f)
|
||||
|
||||
has_deprecated = any([f.deprecated for f in field.fields])
|
||||
deprecated = ",deprecated" if has_deprecated else ""
|
||||
|
||||
pbname = self.to_camel_case(field.typename)
|
||||
# And now we can convert the current field:
|
||||
self.write(f"""\
|
||||
#[allow(unused_variables,deprecated)]
|
||||
#[allow(unused_variables{deprecated})]
|
||||
impl From<pb::{pbname}> for {prefix}::{field.typename} {{
|
||||
fn from(c: pb::{pbname}) -> Self {{
|
||||
Self {{
|
||||
|
|
Loading…
Add table
Reference in a new issue