mirror of
https://codeberg.org/demostf/parser.git
synced 2026-06-04 02:24:12 +02:00
clippy fixes
This commit is contained in:
parent
f1608357ad
commit
11c7fb507f
13 changed files with 42 additions and 54 deletions
|
|
@ -60,9 +60,9 @@ pub struct PacketEntity {
|
|||
|
||||
impl fmt::Display for PacketEntity {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
write!(f, "{}({}) {{\n", self.entity_index, self.server_class)?;
|
||||
writeln!(f, "{}({}) {{", self.entity_index, self.server_class)?;
|
||||
for child in self.props.iter() {
|
||||
write!(f, "\t{}\n", child)?;
|
||||
writeln!(f, "\t{}", child)?;
|
||||
}
|
||||
write!(f, "}}")
|
||||
}
|
||||
|
|
@ -251,10 +251,10 @@ impl PacketEntitiesMessage {
|
|||
});
|
||||
}
|
||||
None => {
|
||||
return Err(ParseError::from(ParseError::PropIndexOutOfBounds {
|
||||
return Err(ParseError::PropIndexOutOfBounds {
|
||||
index,
|
||||
prop_count: send_table.flattened_props.len(),
|
||||
}));
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -124,7 +124,7 @@ impl Parse for UpdateStringTableMessage {
|
|||
|
||||
let entries = match state.string_tables.get(table_id as usize) {
|
||||
Some(table) => parse_string_table_update(&mut data, table, changed),
|
||||
None => return Err(ParseError::StringTableNotFound(table_id).into()),
|
||||
None => return Err(ParseError::StringTableNotFound(table_id)),
|
||||
}?;
|
||||
|
||||
Ok(UpdateStringTableMessage { table_id, entries })
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ impl BitRead<LittleEndian> for UserMessage {
|
|||
|
||||
impl ParseBitSkip for UserMessage {
|
||||
fn parse_skip(stream: &mut Stream) -> Result<()> {
|
||||
let _ = stream.skip_bits(8)?;
|
||||
stream.skip_bits(8)?;
|
||||
let length: u32 = stream.read_int(11)?;
|
||||
stream.skip_bits(length as usize).map_err(ParseError::from)
|
||||
}
|
||||
|
|
@ -163,7 +163,7 @@ impl BitRead<LittleEndian> for SayText2Message {
|
|||
if first == 7 {
|
||||
let _color = stream.read_string(Some(6))?;
|
||||
} else {
|
||||
let _ = stream.skip_bits(8)?;
|
||||
stream.skip_bits(8)?;
|
||||
}
|
||||
|
||||
let text: String = stream.read().or_else(handle_utf8_error)?;
|
||||
|
|
@ -179,12 +179,12 @@ impl BitRead<LittleEndian> for SayText2Message {
|
|||
(ChatMessageKind::ChatAll, None, text)
|
||||
}
|
||||
} else {
|
||||
let _ = stream.set_pos(stream.pos() - 8)?;
|
||||
stream.set_pos(stream.pos() - 8)?;
|
||||
|
||||
let kind = stream.read()?;
|
||||
let from = stream.read().or_else(handle_utf8_error)?;
|
||||
let text = stream.read().or_else(handle_utf8_error)?;
|
||||
let _ = stream.skip_bits(16)?;
|
||||
stream.skip_bits(16)?;
|
||||
(kind, Some(from), text)
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue