diff --git a/benches/proguard_parsing.rs b/benches/proguard_parsing.rs index 1d5fbf8..94f528a 100644 --- a/benches/proguard_parsing.rs +++ b/benches/proguard_parsing.rs @@ -8,7 +8,7 @@ fn proguard_mapper(mapping: ProguardMapping) -> ProguardMapper { ProguardMapper::new(mapping) } -fn proguard_cache(cache: &[u8]) -> ProguardCache { +fn proguard_cache(cache: &[u8]) -> ProguardCache<'_> { ProguardCache::parse(cache).unwrap() } diff --git a/src/cache/debug.rs b/src/cache/debug.rs index af22d9a..957308d 100644 --- a/src/cache/debug.rs +++ b/src/cache/debug.rs @@ -196,7 +196,7 @@ impl<'data> ProguardCache<'data> { /// Creates a view of the cache that implements `Display`. /// /// The `Display` impl is very similar to the original proguard format. - pub fn display(&self) -> CacheDebug { + pub fn display(&self) -> CacheDebug<'_, '_> { CacheDebug { cache: self } } } diff --git a/src/mapping.rs b/src/mapping.rs index 055a455..fb8d1bf 100644 --- a/src/mapping.rs +++ b/src/mapping.rs @@ -463,7 +463,7 @@ impl<'s> ProguardRecord<'s> { /// Parses a single line from a Proguard File. /// /// Returns `Err(ParseError)` if the line could not be parsed. -fn parse_proguard_record(bytes: &[u8]) -> (Result, &[u8]) { +fn parse_proguard_record(bytes: &[u8]) -> (Result, ParseError<'_>>, &[u8]) { let bytes = consume_leading_newlines(bytes); let result = if let Some(bytes) = bytes.trim_ascii_start().strip_prefix(b"#") { @@ -497,7 +497,7 @@ fn parse_proguard_record(bytes: &[u8]) -> (Result, & } /// Parses a single Proguard Header from a Proguard File. -fn parse_proguard_header(bytes: &[u8]) -> Result<(ProguardRecord, &[u8]), ParseError> { +fn parse_proguard_header(bytes: &[u8]) -> Result<(ProguardRecord<'_>, &[u8]), ParseError<'_>> { // Note: the leading `#` has already been parsed. // Existing logic for `key: value` format @@ -516,7 +516,7 @@ fn parse_proguard_header(bytes: &[u8]) -> Result<(ProguardRecord, &[u8]), ParseE Ok((record, consume_leading_newlines(bytes))) } -fn parse_r8_header(bytes: &[u8]) -> Result<(ProguardRecord, &[u8]), ParseError> { +fn parse_r8_header(bytes: &[u8]) -> Result<(ProguardRecord<'_>, &[u8]), ParseError<'_>> { // Note: the leading `#` has already been parsed. let (header, rest) = parse_until(bytes, is_newline)?; @@ -532,7 +532,9 @@ fn parse_r8_header(bytes: &[u8]) -> Result<(ProguardRecord, &[u8]), ParseError> } /// Parses a single Proguard Field or Method from a Proguard File. -fn parse_proguard_field_or_method(bytes: &[u8]) -> Result<(ProguardRecord, &[u8]), ParseError> { +fn parse_proguard_field_or_method( + bytes: &[u8], +) -> Result<(ProguardRecord<'_>, &[u8]), ParseError<'_>> { // field line or method line: // `originalfieldtype originalfieldname -> obfuscatedfieldname` // `[startline:endline:]originalreturntype [originalclassname.]originalmethodname(originalargumenttype,...)[:originalstartline[:originalendline]] -> obfuscatedmethodname` @@ -635,7 +637,7 @@ fn parse_proguard_field_or_method(bytes: &[u8]) -> Result<(ProguardRecord, &[u8] } /// Parses a single Proguard Class from a Proguard File. -fn parse_proguard_class(bytes: &[u8]) -> Result<(ProguardRecord, &[u8]), ParseError> { +fn parse_proguard_class(bytes: &[u8]) -> Result<(ProguardRecord<'_>, &[u8]), ParseError<'_>> { // class line: // `originalclassname -> obfuscatedclassname:` let (original, bytes) = parse_until_no_newline(bytes, |c| *c == b' ')?; @@ -654,7 +656,7 @@ fn parse_proguard_class(bytes: &[u8]) -> Result<(ProguardRecord, &[u8]), ParseEr Ok((record, consume_leading_newlines(bytes))) } -fn parse_usize(bytes: &[u8]) -> Result<(usize, &[u8]), ParseError> { +fn parse_usize(bytes: &[u8]) -> Result<(usize, &[u8]), ParseError<'_>> { let (slice, rest) = match bytes.iter().position(|c| !(*c as char).is_numeric()) { Some(pos) => bytes.split_at(pos), None => (bytes, &[] as &[u8]), @@ -682,7 +684,7 @@ fn parse_prefix<'s>(bytes: &'s [u8], prefix: &'s [u8]) -> Result<&'s [u8], Parse }) } -fn parse_until

(bytes: &[u8], predicate: P) -> Result<(&str, &[u8]), ParseError> +fn parse_until

(bytes: &[u8], predicate: P) -> Result<(&str, &[u8]), ParseError<'_>> where P: Fn(&u8) -> bool, { @@ -700,7 +702,7 @@ where } } -fn parse_until_no_newline

(bytes: &[u8], predicate: P) -> Result<(&str, &[u8]), ParseError> +fn parse_until_no_newline

(bytes: &[u8], predicate: P) -> Result<(&str, &[u8]), ParseError<'_>> where P: Fn(&u8) -> bool, { diff --git a/src/stacktrace.rs b/src/stacktrace.rs index d95743b..9b6754c 100644 --- a/src/stacktrace.rs +++ b/src/stacktrace.rs @@ -278,7 +278,7 @@ impl Display for StackFrame<'_> { /// Parses a single line from a Java StackTrace. /// /// Returns `None` if the line could not be parsed. -pub(crate) fn parse_frame(line: &str) -> Option { +pub(crate) fn parse_frame(line: &str) -> Option> { let line = line.trim(); if !line.starts_with("at ") || !line.ends_with(')') {