From a82a2105fd1b1a99bddb835ed1d9dbf2e2a5c56f Mon Sep 17 00:00:00 2001 From: Rusty Wagner Date: Fri, 22 Dec 2023 16:44:34 -0700 Subject: Use unwrap_or_else to avoid running error path code when there isn't an error --- rust/src/llil/lifting.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'rust/src/llil/lifting.rs') diff --git a/rust/src/llil/lifting.rs b/rust/src/llil/lifting.rs index bd023933..f40f9529 100644 --- a/rust/src/llil/lifting.rs +++ b/rust/src/llil/lifting.rs @@ -1380,7 +1380,7 @@ where use binaryninjacore_sys::BNLowLevelILSetCurrentAddress; let loc: Location = loc.into(); - let arch = loc.arch.unwrap_or(*self.arch().as_ref()); + let arch = loc.arch.unwrap_or_else(|| *self.arch().as_ref()); unsafe { BNLowLevelILSetCurrentAddress(self.handle, arch.0, loc.addr); @@ -1391,7 +1391,7 @@ where use binaryninjacore_sys::BNGetLowLevelILLabelForAddress; let loc: Location = loc.into(); - let arch = loc.arch.unwrap_or(*self.arch().as_ref()); + let arch = loc.arch.unwrap_or_else(|| *self.arch().as_ref()); let res = unsafe { BNGetLowLevelILLabelForAddress(self.handle, arch.0, loc.addr) }; -- cgit v1.3.1