From 69d40ab6a36dfcea771b8020dc3f764702301b17 Mon Sep 17 00:00:00 2001 From: Roman Zavarnitsyn Date: Fri, 24 Oct 2025 11:56:03 +0200 Subject: [PATCH 1/3] build: Fix new compiler warnings --- src/cache/debug.rs | 2 +- src/mapping.rs | 16 ++++++++-------- src/stacktrace.rs | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) 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..f30474e 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,7 @@ 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 +635,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 +654,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 +682,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 +700,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(')') { From 68ab4b1c3659be8817124483b4c736262ed20c4b Mon Sep 17 00:00:00 2001 From: Roman Zavarnitsyn Date: Fri, 24 Oct 2025 11:58:13 +0200 Subject: [PATCH 2/3] formatting --- src/mapping.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/mapping.rs b/src/mapping.rs index f30474e..fb8d1bf 100644 --- a/src/mapping.rs +++ b/src/mapping.rs @@ -532,7 +532,9 @@ fn parse_r8_header(bytes: &[u8]) -> Result<(ProguardRecord<'_>, &[u8]), ParseErr } /// 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` From ec50801a7df79b5ecc1557767641f0ff981ffd97 Mon Sep 17 00:00:00 2001 From: Roman Zavarnitsyn Date: Fri, 24 Oct 2025 12:02:01 +0200 Subject: [PATCH 3/3] fix warning --- benches/proguard_parsing.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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() }