mirror of
https://codeberg.org/demostf/parser.git
synced 2026-06-03 10:14:06 +02:00
fmt+clippy
This commit is contained in:
parent
43c9021ba2
commit
2bad24dedd
30 changed files with 947 additions and 3396 deletions
|
|
@ -157,7 +157,7 @@ impl<'a> BitRead<'a, LittleEndian> for UserMessage<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a> BitWrite<LittleEndian> for UserMessage<'a> {
|
||||
impl BitWrite<LittleEndian> for UserMessage<'_> {
|
||||
fn write(&self, stream: &mut BitWriteStream<LittleEndian>) -> ReadResult<()> {
|
||||
self.message_type().write(stream)?;
|
||||
stream.reserve_length(11, |stream| match self {
|
||||
|
|
|
|||
|
|
@ -104,7 +104,7 @@ impl<'a> BitRead<'a, LittleEndian> for ParseSoundsMessage<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a> BitWrite<LittleEndian> for ParseSoundsMessage<'a> {
|
||||
impl BitWrite<LittleEndian> for ParseSoundsMessage<'_> {
|
||||
fn write(&self, stream: &mut BitWriteStream<LittleEndian>) -> ReadResult<()> {
|
||||
self.reliable.write(stream)?;
|
||||
if !self.reliable {
|
||||
|
|
|
|||
|
|
@ -73,13 +73,13 @@ pub struct DemoHandler<'a, T: MessageHandler> {
|
|||
pub state_handler: ParserState,
|
||||
}
|
||||
|
||||
impl<'a> DemoHandler<'a, NullHandler> {
|
||||
impl DemoHandler<'_, NullHandler> {
|
||||
pub fn new() -> Self {
|
||||
Self::parse_all_with_analyser(NullHandler)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Default for DemoHandler<'a, NullHandler> {
|
||||
impl Default for DemoHandler<'_, NullHandler> {
|
||||
fn default() -> Self {
|
||||
DemoHandler::new()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -63,24 +63,24 @@ pub struct DemoParser<'a, A: MessageHandler> {
|
|||
}
|
||||
|
||||
impl<'a> DemoParser<'a, Analyser> {
|
||||
pub fn new(stream: Stream<'a>) -> DemoParser<Analyser> {
|
||||
pub fn new(stream: Stream<'a>) -> Self {
|
||||
DemoParser::new_with_analyser(stream, Analyser::new())
|
||||
}
|
||||
|
||||
pub fn new_all(stream: Stream<'a>) -> DemoParser<Analyser> {
|
||||
pub fn new_all(stream: Stream<'a>) -> Self {
|
||||
DemoParser::new_all_with_analyser(stream, Analyser::new())
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, A: MessageHandler> DemoParser<'a, A> {
|
||||
pub fn new_with_analyser(stream: Stream<'a>, analyser: A) -> DemoParser<A> {
|
||||
pub fn new_with_analyser(stream: Stream<'a>, analyser: A) -> Self {
|
||||
DemoParser {
|
||||
handler: DemoHandler::with_analyser(analyser),
|
||||
stream,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn new_all_with_analyser(stream: Stream<'a>, analyser: A) -> DemoParser<A> {
|
||||
pub fn new_all_with_analyser(stream: Stream<'a>, analyser: A) -> Self {
|
||||
DemoParser {
|
||||
handler: DemoHandler::parse_all_with_analyser(analyser),
|
||||
stream,
|
||||
|
|
@ -158,7 +158,7 @@ pub struct DemoTicker<'a, A: MessageHandler> {
|
|||
packets: RawPacketStream<'a>,
|
||||
}
|
||||
|
||||
impl<'a, A: MessageHandler> DemoTicker<'a, A> {
|
||||
impl<A: MessageHandler> DemoTicker<'_, A> {
|
||||
/// Process the next packet
|
||||
///
|
||||
/// returns whether or not there are still packets left in the demo
|
||||
|
|
@ -179,7 +179,7 @@ impl<'a, A: MessageHandler> DemoTicker<'a, A> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a, A: MessageHandler + BorrowMessageHandler> DemoTicker<'a, A> {
|
||||
impl<A: MessageHandler + BorrowMessageHandler> DemoTicker<'_, A> {
|
||||
pub fn state(&self) -> &A::Output {
|
||||
self.handler.borrow_output()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ impl StaticBaseline {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a> ParserState {
|
||||
impl ParserState {
|
||||
pub fn new(
|
||||
protocol_version: u32,
|
||||
analyser_handles: fn(message_type: MessageType) -> bool,
|
||||
|
|
@ -294,12 +294,7 @@ impl<'a> ParserState {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn handle_string_entry(
|
||||
&mut self,
|
||||
table: &str,
|
||||
_index: usize,
|
||||
entry: &StringTableEntry<'a>,
|
||||
) {
|
||||
pub fn handle_string_entry(&mut self, table: &str, _index: usize, entry: &StringTableEntry) {
|
||||
if table == "instancebaseline" {
|
||||
if let (Some(extra), Ok(class_id)) = (&entry.extra_data, entry.text().parse()) {
|
||||
let baseline = StaticBaseline::new(class_id, extra.data.to_owned());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue