mirror of
https://codeberg.org/demostf/parser.git
synced 2026-10-01 08:44:05 +02:00
clippy fixes
This commit is contained in:
parent
1a5960f7c4
commit
6cfd4990a6
13 changed files with 55 additions and 61 deletions
|
|
@ -161,11 +161,7 @@ impl<'a> ParseBitSkip<'a> for CreateStringTableMessage<'a> {
|
|||
|
||||
#[cfg(feature = "write")]
|
||||
impl Encode for CreateStringTableMessage<'_> {
|
||||
fn encode(
|
||||
&self,
|
||||
stream: &mut BitWriteStream<LittleEndian>,
|
||||
state: &ParserState,
|
||||
) -> Result<()> {
|
||||
fn encode(&self, stream: &mut BitWriteStream<LittleEndian>, state: &ParserState) -> Result<()> {
|
||||
let table = &self.table;
|
||||
table.name.write(stream)?;
|
||||
table.max_entries.write(stream)?;
|
||||
|
|
@ -173,12 +169,11 @@ impl Encode for CreateStringTableMessage<'_> {
|
|||
(table.entries.len() as u16).write_sized(stream, encode_bits + 1)?;
|
||||
|
||||
// threshold and both widths are the ones used by the read side above
|
||||
let (length_bits, encode_length): (usize, fn(u32) -> u64) =
|
||||
if state.protocol_version > 23 {
|
||||
(40, encode_var_int_fixed)
|
||||
} else {
|
||||
(20, |length| length as u64)
|
||||
};
|
||||
let (length_bits, encode_length): (usize, fn(u32) -> u64) = if state.protocol_version > 23 {
|
||||
(40, encode_var_int_fixed)
|
||||
} else {
|
||||
(20, |length| length as u64)
|
||||
};
|
||||
stream.reserve_int::<ParseError, _>(length_bits, |stream| {
|
||||
table.fixed_user_data_size.is_some().write(stream)?;
|
||||
if let Some(fixed_size) = table.fixed_user_data_size {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue