Skip to content

Commit 695c543

Browse files
authored
build: Fix new compiler warnings (#61)
1 parent 4f47c6a commit 695c543

4 files changed

Lines changed: 13 additions & 11 deletions

File tree

benches/proguard_parsing.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ fn proguard_mapper(mapping: ProguardMapping) -> ProguardMapper {
88
ProguardMapper::new(mapping)
99
}
1010

11-
fn proguard_cache(cache: &[u8]) -> ProguardCache {
11+
fn proguard_cache(cache: &[u8]) -> ProguardCache<'_> {
1212
ProguardCache::parse(cache).unwrap()
1313
}
1414

src/cache/debug.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ impl<'data> ProguardCache<'data> {
196196
/// Creates a view of the cache that implements `Display`.
197197
///
198198
/// The `Display` impl is very similar to the original proguard format.
199-
pub fn display(&self) -> CacheDebug {
199+
pub fn display(&self) -> CacheDebug<'_, '_> {
200200
CacheDebug { cache: self }
201201
}
202202
}

src/mapping.rs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,7 @@ impl<'s> ProguardRecord<'s> {
463463
/// Parses a single line from a Proguard File.
464464
///
465465
/// Returns `Err(ParseError)` if the line could not be parsed.
466-
fn parse_proguard_record(bytes: &[u8]) -> (Result<ProguardRecord, ParseError>, &[u8]) {
466+
fn parse_proguard_record(bytes: &[u8]) -> (Result<ProguardRecord<'_>, ParseError<'_>>, &[u8]) {
467467
let bytes = consume_leading_newlines(bytes);
468468

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

499499
/// Parses a single Proguard Header from a Proguard File.
500-
fn parse_proguard_header(bytes: &[u8]) -> Result<(ProguardRecord, &[u8]), ParseError> {
500+
fn parse_proguard_header(bytes: &[u8]) -> Result<(ProguardRecord<'_>, &[u8]), ParseError<'_>> {
501501
// Note: the leading `#` has already been parsed.
502502

503503
// Existing logic for `key: value` format
@@ -516,7 +516,7 @@ fn parse_proguard_header(bytes: &[u8]) -> Result<(ProguardRecord, &[u8]), ParseE
516516
Ok((record, consume_leading_newlines(bytes)))
517517
}
518518

519-
fn parse_r8_header(bytes: &[u8]) -> Result<(ProguardRecord, &[u8]), ParseError> {
519+
fn parse_r8_header(bytes: &[u8]) -> Result<(ProguardRecord<'_>, &[u8]), ParseError<'_>> {
520520
// Note: the leading `#` has already been parsed.
521521

522522
let (header, rest) = parse_until(bytes, is_newline)?;
@@ -532,7 +532,9 @@ fn parse_r8_header(bytes: &[u8]) -> Result<(ProguardRecord, &[u8]), ParseError>
532532
}
533533

534534
/// Parses a single Proguard Field or Method from a Proguard File.
535-
fn parse_proguard_field_or_method(bytes: &[u8]) -> Result<(ProguardRecord, &[u8]), ParseError> {
535+
fn parse_proguard_field_or_method(
536+
bytes: &[u8],
537+
) -> Result<(ProguardRecord<'_>, &[u8]), ParseError<'_>> {
536538
// field line or method line:
537539
// `originalfieldtype originalfieldname -> obfuscatedfieldname`
538540
// `[startline:endline:]originalreturntype [originalclassname.]originalmethodname(originalargumenttype,...)[:originalstartline[:originalendline]] -> obfuscatedmethodname`
@@ -635,7 +637,7 @@ fn parse_proguard_field_or_method(bytes: &[u8]) -> Result<(ProguardRecord, &[u8]
635637
}
636638

637639
/// Parses a single Proguard Class from a Proguard File.
638-
fn parse_proguard_class(bytes: &[u8]) -> Result<(ProguardRecord, &[u8]), ParseError> {
640+
fn parse_proguard_class(bytes: &[u8]) -> Result<(ProguardRecord<'_>, &[u8]), ParseError<'_>> {
639641
// class line:
640642
// `originalclassname -> obfuscatedclassname:`
641643
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
654656
Ok((record, consume_leading_newlines(bytes)))
655657
}
656658

657-
fn parse_usize(bytes: &[u8]) -> Result<(usize, &[u8]), ParseError> {
659+
fn parse_usize(bytes: &[u8]) -> Result<(usize, &[u8]), ParseError<'_>> {
658660
let (slice, rest) = match bytes.iter().position(|c| !(*c as char).is_numeric()) {
659661
Some(pos) => bytes.split_at(pos),
660662
None => (bytes, &[] as &[u8]),
@@ -682,7 +684,7 @@ fn parse_prefix<'s>(bytes: &'s [u8], prefix: &'s [u8]) -> Result<&'s [u8], Parse
682684
})
683685
}
684686

685-
fn parse_until<P>(bytes: &[u8], predicate: P) -> Result<(&str, &[u8]), ParseError>
687+
fn parse_until<P>(bytes: &[u8], predicate: P) -> Result<(&str, &[u8]), ParseError<'_>>
686688
where
687689
P: Fn(&u8) -> bool,
688690
{
@@ -700,7 +702,7 @@ where
700702
}
701703
}
702704

703-
fn parse_until_no_newline<P>(bytes: &[u8], predicate: P) -> Result<(&str, &[u8]), ParseError>
705+
fn parse_until_no_newline<P>(bytes: &[u8], predicate: P) -> Result<(&str, &[u8]), ParseError<'_>>
704706
where
705707
P: Fn(&u8) -> bool,
706708
{

src/stacktrace.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ impl Display for StackFrame<'_> {
278278
/// Parses a single line from a Java StackTrace.
279279
///
280280
/// Returns `None` if the line could not be parsed.
281-
pub(crate) fn parse_frame(line: &str) -> Option<StackFrame> {
281+
pub(crate) fn parse_frame(line: &str) -> Option<StackFrame<'_>> {
282282
let line = line.trim();
283283

284284
if !line.starts_with("at ") || !line.ends_with(')') {

0 commit comments

Comments
 (0)