Skip to content

Commit acd786a

Browse files
committed
fixup! Add term_params to Metadata
1 parent 0584ff0 commit acd786a

File tree

1 file changed

+11
-17
lines changed

1 file changed

+11
-17
lines changed

state/src/item/metadata.rs

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -146,24 +146,18 @@ impl Encodable for Metadata {
146146
let params_changed = self.seq != 0;
147147
let term_params_exist = self.term_params.is_some();
148148

149-
let mut len = INITIAL_LEN;
150-
// Clippy complain how `let mut len` statements are constructed,
151-
// but their alternative is uglier
152-
#[allow(clippy::useless_let_if_seq)]
153-
{
154-
if term_changed {
155-
len = TERM_LEN;
156-
}
157-
if params_changed {
158-
len = PARAMS_LEN;
159-
}
160-
if term_params_exist {
161-
if !params_changed {
162-
panic!("Term params only can be changed if params changed");
163-
}
164-
len = TERM_PARAMS_LEN;
149+
let len = if term_params_exist {
150+
if !params_changed {
151+
panic!("Term params only can be changed if params changed");
165152
}
166-
}
153+
TERM_PARAMS_LEN
154+
} else if params_changed {
155+
PARAMS_LEN
156+
} else if term_changed {
157+
TERM_LEN
158+
} else {
159+
INITIAL_LEN
160+
};
167161

168162
s.begin_list(len)
169163
.append(&PREFIX)

0 commit comments

Comments
 (0)