From d3e0d1bd58115f581cae6441c863ba85805007ff Mon Sep 17 00:00:00 2001 From: Daniel Schadt Date: Fri, 1 May 2020 21:36:19 +0200 Subject: add a comment about redundant closures --- src/raw/parser.rs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/raw') diff --git a/src/raw/parser.rs b/src/raw/parser.rs index a9d8e8a..b7d6aad 100644 --- a/src/raw/parser.rs +++ b/src/raw/parser.rs @@ -412,7 +412,12 @@ pub fn parse_partial_file(mut input: R) -> ParseResult { /// /// * `partial` - The partial EVTC. /// * `input` - The input stream. +#[allow(clippy::redundant_closure)] pub fn finish_parsing(partial: PartialEvtc, input: R) -> ParseResult { + // The following closures seem redundant, but they are needed to convice Rust that we can + // actually use parse_event_rev* here. That is because we require a lifetime bound of + // for<'r> fn(&'r mut R) -> ParseResult + // which we cannot get by just plugging in parse_event_rev*. let events = match partial.header.revision { 0 => parse_events(input, |r| parse_event_rev0(r))?, 1 => parse_events(input, |r| parse_event_rev1(r))?, -- cgit v1.2.3