diff --git a/Cargo.lock b/Cargo.lock index bc1102a..7765341 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -334,7 +334,7 @@ dependencies = [ [[package]] name = "proguard" -version = "5.6.1" +version = "5.6.2" dependencies = [ "criterion", "serde", diff --git a/Cargo.toml b/Cargo.toml index b69a7eb..c7282c7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,6 +13,9 @@ edition = "2021" [features] uuid = ["dep:uuid"] +[lints.clippy] +unwrap-used = "warn" + [dependencies] serde = { version = "1.0.219", features = ["derive"] } serde_json = "1.0.140" diff --git a/benches/proguard_mapping.rs b/benches/proguard_mapping.rs index eddeea1..65621db 100644 --- a/benches/proguard_mapping.rs +++ b/benches/proguard_mapping.rs @@ -1,3 +1,4 @@ +#![allow(clippy::unwrap_used)] use criterion::{black_box, criterion_group, criterion_main, Criterion}; use proguard::{ProguardCache, ProguardMapper, ProguardMapping}; diff --git a/benches/proguard_parsing.rs b/benches/proguard_parsing.rs index b118d2d..1d5fbf8 100644 --- a/benches/proguard_parsing.rs +++ b/benches/proguard_parsing.rs @@ -1,3 +1,4 @@ +#![allow(clippy::unwrap_used)] use criterion::{black_box, criterion_group, criterion_main, Criterion}; use proguard::{ProguardCache, ProguardMapper, ProguardMapping}; diff --git a/clippy.toml b/clippy.toml new file mode 100644 index 0000000..154626e --- /dev/null +++ b/clippy.toml @@ -0,0 +1 @@ +allow-unwrap-in-tests = true diff --git a/src/cache/debug.rs b/src/cache/debug.rs index 34984c0..af22d9a 100644 --- a/src/cache/debug.rs +++ b/src/cache/debug.rs @@ -15,13 +15,13 @@ impl ClassDebug<'_, '_> { fn obfuscated_name(&self) -> &str { self.cache .read_string(self.raw.obfuscated_name_offset) - .unwrap() + .unwrap_or("") } fn original_name(&self) -> &str { self.cache .read_string(self.raw.original_name_offset) - .unwrap() + .unwrap_or("") } fn file_name(&self) -> Option<&str> { @@ -76,13 +76,13 @@ impl MemberDebug<'_, '_> { fn obfuscated_name(&self) -> &str { self.cache .read_string(self.raw.obfuscated_name_offset) - .unwrap() + .unwrap_or("") } fn original_name(&self) -> &str { self.cache .read_string(self.raw.original_name_offset) - .unwrap() + .unwrap_or("") } fn original_endline(&self) -> Option { diff --git a/src/stacktrace.rs b/src/stacktrace.rs index 1e61375..d95743b 100644 --- a/src/stacktrace.rs +++ b/src/stacktrace.rs @@ -129,13 +129,11 @@ fn parse_stacktrace(content: &str) -> Option> { if let Some(frame) = parse_frame(line) { current.frames.push(frame); } else if let Some(line) = line.strip_prefix("Caused by: ") { - current.cause = Some(Box::new(StackTrace { + current = current.cause.insert(Box::new(StackTrace { exception: parse_throwable(line), frames: vec![], cause: None, })); - // We just set the `cause` so it's safe to unwrap here - current = current.cause.as_deref_mut().unwrap(); } }