Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion benches/proguard_parsing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}

Expand Down
2 changes: 1 addition & 1 deletion src/cache/debug.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
}
}
18 changes: 10 additions & 8 deletions src/mapping.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<ProguardRecord, ParseError>, &[u8]) {
fn parse_proguard_record(bytes: &[u8]) -> (Result<ProguardRecord<'_>, ParseError<'_>>, &[u8]) {
let bytes = consume_leading_newlines(bytes);

let result = if let Some(bytes) = bytes.trim_ascii_start().strip_prefix(b"#") {
Expand Down Expand Up @@ -497,7 +497,7 @@ fn parse_proguard_record(bytes: &[u8]) -> (Result<ProguardRecord, ParseError>, &
}

/// 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
Expand All @@ -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)?;
Expand All @@ -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`
Expand Down Expand Up @@ -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' ')?;
Expand All @@ -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]),
Expand Down Expand Up @@ -682,7 +684,7 @@ fn parse_prefix<'s>(bytes: &'s [u8], prefix: &'s [u8]) -> Result<&'s [u8], Parse
})
}

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

fn parse_until_no_newline<P>(bytes: &[u8], predicate: P) -> Result<(&str, &[u8]), ParseError>
fn parse_until_no_newline<P>(bytes: &[u8], predicate: P) -> Result<(&str, &[u8]), ParseError<'_>>
where
P: Fn(&u8) -> bool,
{
Expand Down
2 changes: 1 addition & 1 deletion src/stacktrace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<StackFrame> {
pub(crate) fn parse_frame(line: &str) -> Option<StackFrame<'_>> {
let line = line.trim();

if !line.starts_with("at ") || !line.ends_with(')') {
Expand Down
Loading