mirror of
https://github.com/rust-lang/rust.git
synced 2025-01-26 14:43:24 +00:00
Use count! macro in tuple length computation
This commit is contained in:
parent
19288951e1
commit
6f711a37e3
@ -591,9 +591,8 @@ macro_rules! tuple {
|
||||
#[allow(non_snake_case)]
|
||||
fn encode(&self, s: &mut S) -> Result<(), S::Error> {
|
||||
let ($(ref $name,)+) = *self;
|
||||
let mut n = 0;
|
||||
$(let $name = $name; n += 1;)+
|
||||
s.emit_tuple(n, |s| {
|
||||
let len: usize = count!($($name)+);
|
||||
s.emit_tuple(len, |s| {
|
||||
let mut i = 0;
|
||||
$(s.emit_tuple_arg({ i+=1; i-1 }, |s| $name.encode(s))?;)+
|
||||
Ok(())
|
||||
|
Loading…
Reference in New Issue
Block a user