Skip to content

Commit e3d2016

Browse files
committed
inline constants in generated enum Encode impls
1 parent 0355358 commit e3d2016

File tree

1 file changed

+2
-7
lines changed
  • library/proc_macro/src/bridge

1 file changed

+2
-7
lines changed

library/proc_macro/src/bridge/rpc.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,16 +58,11 @@ macro_rules! rpc_encode_decode {
5858
fn encode(self, w: &mut Writer, s: &mut S) {
5959
// HACK(eddyb): `Tag` enum duplicated between the
6060
// two impls as there's no other place to stash it.
61-
#[allow(non_upper_case_globals)]
62-
mod tag {
63-
#[repr(u8)] enum Tag { $($variant),* }
64-
65-
$(pub(crate) const $variant: u8 = Tag::$variant as u8;)*
66-
}
61+
#[repr(u8)] enum Tag { $($variant),* }
6762

6863
match self {
6964
$($name::$variant $(($field))* => {
70-
tag::$variant.encode(w, s);
65+
(Tag::$variant as u8).encode(w, s);
7166
$($field.encode(w, s);)*
7267
})*
7368
}

0 commit comments

Comments
 (0)