From efe6584c445515177909efc290c6a0ea41def7b0 Mon Sep 17 00:00:00 2001 From: raptor Date: Mon, 18 Nov 2024 05:22:33 +0100 Subject: [PATCH] clippy lint fixes (#18) --- GITHUB-ACTIONS.md | 4 +- idalib-build/src/lib.rs | 4 +- idalib-sys/build.rs | 10 +++- idalib-sys/src/lib.rs | 90 +++++++++++++++++------------- idalib-sys/src/platform.rs | 2 +- idalib/examples/decrypt_strings.rs | 6 +- idalib/examples/dump_ls.rs | 8 ++- idalib/src/decompiler.rs | 4 ++ idalib/src/func.rs | 46 ++++++++------- idalib/src/idb.rs | 20 +++---- idalib/src/insn.rs | 4 ++ idalib/src/lib.rs | 2 +- idalib/src/meta.rs | 4 +- idalib/src/segment.rs | 34 ++++++----- idalib/src/xref.rs | 4 +- 15 files changed, 138 insertions(+), 104 deletions(-) diff --git a/GITHUB-ACTIONS.md b/GITHUB-ACTIONS.md index 61fa5be67..ea37129fb 100644 --- a/GITHUB-ACTIONS.md +++ b/GITHUB-ACTIONS.md @@ -7,14 +7,13 @@ hosting/generation. To help downstream consumers of idalib avoid headaches, we have documented how we've setup GitHub Actions for idalib to perform a build a viability test on each supported OS, and to generate and deploy documentation. - ## Prerequisites To adapt the workflows in this document in your own project, you need to configure two repository secrets via Settings -> Secrets and variables -> Actions: -- `IDASDK90_URL`: a publicly accessible encrypted/password protected archive +- `IDASDK90_URL`: a publicly accessible encrypted/password-protected archive containing he latest IDA SDK. We are using a zip in our workflow below, but it should be straightforward to use an approach like [binexport](https://github.com/google/binexport/blob/23619ba62d88b3b93615d28fe3033489d12b38ac/.github/workflows/cmake.yml#L25), @@ -130,7 +129,6 @@ a branch to keep the documentation separate from the source code, e.g., GitHub Pages needs to be configured via Settings -> Pages by setting "Source" to "Deploy from a branch" and "branch" to "gh-pages". - ```yml name: document diff --git a/idalib-build/src/lib.rs b/idalib-build/src/lib.rs index 7275add50..be0f6aef3 100644 --- a/idalib-build/src/lib.rs +++ b/idalib-build/src/lib.rs @@ -58,9 +58,7 @@ pub fn idalib_install_paths() -> (PathBuf, PathBuf, PathBuf) { } pub fn idalib_install_paths_with(check: bool) -> (PathBuf, PathBuf, PathBuf) { - let path = env::var("IDADIR") - .map(PathBuf::from) - .unwrap_or_else(|_| link_path()); + let path = env::var("IDADIR").map_or_else(|_| link_path(), PathBuf::from); let (idalib, ida) = if cfg!(target_os = "linux") { (path.join("libidalib.so"), path.join("libida.so")) diff --git a/idalib-sys/build.rs b/idalib-sys/build.rs index 1f27b7e34..2fd67dcdf 100644 --- a/idalib-sys/build.rs +++ b/idalib-sys/build.rs @@ -33,7 +33,7 @@ fn main() { let ffi_path = PathBuf::from("src"); - let mut builder = autocxx_build::Builder::new(ffi_path.join("lib.rs"), &[&ffi_path, &ida]) + let mut builder = autocxx_build::Builder::new(ffi_path.join("lib.rs"), [&ffi_path, &ida]) .extra_clang_args( #[cfg(target_os = "linux")] &["-std=c++17", "-D__LINUX__=1", "-D__EA64__=1"], @@ -125,7 +125,7 @@ fn main() { ("MIPS_.*", "insn_mips.rs"), ]; - for (prefix, output) in insn_consts.into_iter() { + for (prefix, output) in insn_consts { let arch = autocxx_bindgen::builder() .header(ida.join("pro.h").to_str().expect("path is valid string")) .header( @@ -141,7 +141,11 @@ fn main() { let hexrays = autocxx_bindgen::builder() .header(ida.join("pro.h").to_str().expect("path is valid string")) - .header(ida.join("hexrays.hpp").to_str().expect("path is valid string")) + .header( + ida.join("hexrays.hpp") + .to_str() + .expect("path is valid string"), + ) .opaque_type("std::.*") .opaque_type("carglist_t") .allowlist_item("cfunc_t") diff --git a/idalib-sys/src/lib.rs b/idalib-sys/src/lib.rs index 9a4f4cafa..0838945d0 100644 --- a/idalib-sys/src/lib.rs +++ b/idalib-sys/src/lib.rs @@ -10,11 +10,11 @@ pub enum IDAError { #[error(transparent)] Ffi(anyhow::Error), #[error("could not initialise IDA: error code {:x}", _0.0)] - Init(autocxx::c_int), + Init(c_int), #[error("could not open IDA database: error code {:x}", _0.0)] - OpenDb(autocxx::c_int), + OpenDb(c_int), #[error("could not close IDA database: error code {:x}", _0.0)] - CloseDb(autocxx::c_int), + CloseDb(c_int), #[error("invalid license")] InvalidLicense, #[error("could not generate pattern or signature files")] @@ -965,20 +965,22 @@ pub mod ida { pub use ffi::auto_wait; pub fn is_license_valid() -> bool { - if !is_main_thread() { - panic!("IDA cannot function correctly when not running on the main thread"); - } + assert!( + is_main_thread(), + "IDA cannot function correctly when not running on the main thread" + ); - unsafe { self::ffix::idalib_check_license() } + unsafe { ffix::idalib_check_license() } } pub fn license_id() -> Result<[u8; 6], IDAError> { - if !is_main_thread() { - panic!("IDA cannot function correctly when not running on the main thread"); - } + assert!( + is_main_thread(), + "IDA cannot function correctly when not running on the main thread" + ); let mut lid = [0u8; 6]; - if unsafe { self::ffix::idalib_get_license_id(&mut lid) } { + if unsafe { ffix::idalib_get_license_id(&mut lid) } { Ok(lid) } else { Err(IDAError::InvalidLicense) @@ -987,13 +989,14 @@ pub mod ida { // NOTE: once; main thread pub fn init_library() -> Result<(), IDAError> { - if !is_main_thread() { - panic!("IDA cannot function correctly when not running on the main thread"); - } + assert!( + is_main_thread(), + "IDA cannot function correctly when not running on the main thread" + ); env::set_var("TVHEADLESS", "1"); - let res = unsafe { self::ffix::init_library(c_int(0), ptr::null_mut()) }; + let res = unsafe { ffix::init_library(c_int(0), ptr::null_mut()) }; if res != c_int(0) { Err(IDAError::Init(res)) @@ -1003,11 +1006,12 @@ pub mod ida { } pub fn make_signatures(only_pat: bool) -> Result<(), IDAError> { - if !is_main_thread() { - panic!("IDA cannot function correctly when not running on the main thread"); - } + assert!( + is_main_thread(), + "IDA cannot function correctly when not running on the main thread" + ); - if unsafe { self::ffi::make_signatures(only_pat) } { + if unsafe { ffi::make_signatures(only_pat) } { Ok(()) } else { Err(IDAError::MakeSigs) @@ -1015,18 +1019,21 @@ pub mod ida { } pub fn enable_console_messages(enable: bool) { - if !is_main_thread() { - panic!("IDA cannot function correctly when not running on the main thread"); - } + assert!( + is_main_thread(), + "IDA cannot function correctly when not running on the main thread" + ); - unsafe { self::ffi::enable_console_messages(enable) } + unsafe { ffi::enable_console_messages(enable) } } pub fn set_screen_ea(ea: ea_t) { - if !is_main_thread() { - panic!("IDA cannot function correctly when not running on the main thread"); - } - unsafe { self::ffi::set_screen_ea(ea) } + assert!( + is_main_thread(), + "IDA cannot function correctly when not running on the main thread" + ); + + unsafe { ffi::set_screen_ea(ea) } } pub fn open_database(path: impl AsRef) -> Result<(), IDAError> { @@ -1035,9 +1042,10 @@ pub mod ida { // NOTE: main thread pub fn open_database_with(path: impl AsRef, auto_analysis: bool) -> Result<(), IDAError> { - if !is_main_thread() { - panic!("IDA cannot function correctly when not running on the main thread"); - } + assert!( + is_main_thread(), + "IDA cannot function correctly when not running on the main thread" + ); if !is_license_valid() { return Err(IDAError::InvalidLicense); @@ -1045,7 +1053,7 @@ pub mod ida { let path = CString::new(path.as_ref().to_string_lossy().as_ref()).map_err(IDAError::ffi)?; - let res = unsafe { self::ffi::open_database(path.as_ptr(), auto_analysis) }; + let res = unsafe { ffi::open_database(path.as_ptr(), auto_analysis) }; if res != c_int(0) { Err(IDAError::OpenDb(res)) @@ -1058,9 +1066,10 @@ pub mod ida { path: impl AsRef, auto_analysis: bool, ) -> Result<(), IDAError> { - if !is_main_thread() { - panic!("IDA cannot function correctly when not running on the main thread"); - } + assert!( + is_main_thread(), + "IDA cannot function correctly when not running on the main thread" + ); if !is_license_valid() { return Err(IDAError::InvalidLicense); @@ -1068,7 +1077,7 @@ pub mod ida { let path = CString::new(path.as_ref().to_string_lossy().as_ref()).map_err(IDAError::ffi)?; - let res = unsafe { self::ffix::idalib_open_database_quiet(path.as_ptr(), auto_analysis) }; + let res = unsafe { ffix::idalib_open_database_quiet(path.as_ptr(), auto_analysis) }; if res != c_int(0) { Err(IDAError::OpenDb(res)) @@ -1078,14 +1087,15 @@ pub mod ida { } pub fn close_database() { - close_database_with(true) + close_database_with(true); } pub fn close_database_with(save: bool) { - if !is_main_thread() { - panic!("IDA cannot function correctly when not running on the main thread"); - } + assert!( + is_main_thread(), + "IDA cannot function correctly when not running on the main thread" + ); - unsafe { self::ffi::close_database(save) } + unsafe { ffi::close_database(save) } } } diff --git a/idalib-sys/src/platform.rs b/idalib-sys/src/platform.rs index 37cbeba25..650ee228d 100644 --- a/idalib-sys/src/platform.rs +++ b/idalib-sys/src/platform.rs @@ -18,7 +18,7 @@ fn main_thread_id() -> u32 { static mut MAIN_THREAD_ID: u32 = 0; - /// Function pointer used in CRT initialization section to set the above static field's value. + // Function pointer used in CRT initialization section to set the above static field's value. // Mark as used so this is not removable. #[used] diff --git a/idalib/examples/decrypt_strings.rs b/idalib/examples/decrypt_strings.rs index e9a8f4d6d..1ae6db290 100644 --- a/idalib/examples/decrypt_strings.rs +++ b/idalib/examples/decrypt_strings.rs @@ -17,11 +17,11 @@ struct EncString { impl EncString { fn set_address(&mut self, address: u64) { - self.address = Some(address) + self.address = Some(address); } fn set_size(&mut self, size: usize) { - self.size = Some(size) + self.size = Some(size); } fn ready(self) -> bool { @@ -52,7 +52,7 @@ impl EncString { for i in 0..size { let kbyte = Self::shrink_byte(enc[2 * (size - i - 1)]); - dec[size - i - 1] = kbyte ^ dec[size - i] + dec[size - i - 1] = kbyte ^ dec[size - i]; } for i in (0..size - 1).step_by(2) { diff --git a/idalib/examples/dump_ls.rs b/idalib/examples/dump_ls.rs index 867b97513..1c9e048b7 100644 --- a/idalib/examples/dump_ls.rs +++ b/idalib/examples/dump_ls.rs @@ -57,7 +57,11 @@ fn main() -> anyhow::Result<()> { ); if let Some(df) = decompiled.as_ref() { - println!("statements: {} / {}", df.body().len(), df.body().iter().count()); + println!( + "statements: {} / {}", + df.body().len(), + df.body().iter().count() + ); println!("{}", df.pseudocode()); } @@ -68,7 +72,7 @@ fn main() -> anyhow::Result<()> { blk.end_address() ); - if blk.len() != 0 { + if !blk.is_empty() { let insn = idb.insn_at(blk.start_address()).expect("first instruction"); println!( "- insn: (ea: {:x}, size: {:x}, operands: {}) ", diff --git a/idalib/src/decompiler.rs b/idalib/src/decompiler.rs index 80f34d661..4e59db472 100644 --- a/idalib/src/decompiler.rs +++ b/idalib/src/decompiler.rs @@ -91,4 +91,8 @@ impl<'a> CBlock<'a> { pub fn len(&self) -> usize { unsafe { idalib_hexrays_cblock_len(self.ptr) } } + + pub fn is_empty(&self) -> bool { + self.len() == 0 + } } diff --git a/idalib/src/func.rs b/idalib/src/func.rs index c43ef2bf1..fbd7d8625 100644 --- a/idalib/src/func.rs +++ b/idalib/src/func.rs @@ -44,19 +44,23 @@ impl<'a> BasicBlock<'a> { } pub fn start_address(&self) -> Address { - unsafe { (&*self.as_range_t()).start_ea.into() } + unsafe { (*self.as_range_t()).start_ea.into() } } pub fn end_address(&self) -> Address { - unsafe { (&*self.as_range_t()).end_ea.into() } + unsafe { (*self.as_range_t()).end_ea.into() } } pub fn contains_address(&self, addr: Address) -> bool { - unsafe { (&*self.as_range_t()).contains(addr.into()) } + unsafe { (*self.as_range_t()).contains(addr.into()) } } pub fn len(&self) -> usize { - unsafe { (&*self.as_range_t()).size().0 as _ } + unsafe { (*self.as_range_t()).size().0 as _ } + } + + pub fn is_empty(&self) -> bool { + self.len() == 0 } pub fn is_normal(&self) -> bool { @@ -93,7 +97,7 @@ impl<'a> BasicBlock<'a> { pub fn succs<'b>(&'b self) -> impl ExactSizeIterator + 'b { unsafe { idalib_qbasic_block_succs(self.block) } - .into_iter() + .iter() .map(|v| v.0 as _) } @@ -107,7 +111,7 @@ impl<'a> BasicBlock<'a> { pub fn preds<'b>(&'b self) -> impl ExactSizeIterator + 'b { unsafe { idalib_qbasic_block_preds(self.block) } - .into_iter() + .iter() .map(|v| v.0 as _) } @@ -181,19 +185,23 @@ impl<'a> Function<'a> { } pub fn start_address(&self) -> Address { - unsafe { (&*self.as_range_t()).start_ea.into() } + unsafe { (*self.as_range_t()).start_ea.into() } } pub fn end_address(&self) -> Address { - unsafe { (&*self.as_range_t()).end_ea.into() } + unsafe { (*self.as_range_t()).end_ea.into() } } pub fn contains_address(&self, addr: Address) -> bool { - unsafe { (&*self.as_range_t()).contains(addr.into()) } + unsafe { (*self.as_range_t()).contains(addr.into()) } } pub fn len(&self) -> usize { - unsafe { (&*self.as_range_t()).size().0 as _ } + unsafe { (*self.as_range_t()).size().0 as _ } + } + + pub fn is_empty(&self) -> bool { + self.len() == 0 } pub fn name(&self) -> Option { @@ -212,19 +220,19 @@ impl<'a> Function<'a> { } pub fn is_far(&self) -> bool { - unsafe { (&*self.ptr).is_far() } + unsafe { (*self.ptr).is_far() } } pub fn does_return(&self) -> bool { - unsafe { (&*self.ptr).does_return() } + unsafe { (*self.ptr).does_return() } } pub fn analyzed_sp(&self) -> bool { - unsafe { (&*self.ptr).analyzed_sp() } + unsafe { (*self.ptr).analyzed_sp() } } pub fn need_prolog_analysis(&self) -> bool { - unsafe { (&*self.ptr).need_prolog_analysis() } + unsafe { (*self.ptr).need_prolog_analysis() } } pub fn has_external_refs(&self, ea: Address) -> bool { @@ -241,11 +249,11 @@ impl<'a> Function<'a> { } } - pub fn cfg<'b>(&'b self) -> Result, IDAError> { + pub fn cfg(&self) -> Result { self.cfg_with(FunctionCFGFlags::empty()) } - pub fn cfg_with<'b>(&'b self, flags: FunctionCFGFlags) -> Result, IDAError> { + pub fn cfg_with(&self, flags: FunctionCFGFlags) -> Result { let ptr = unsafe { idalib_func_flow_chart(self.ptr, flags.bits().into()) }; Ok(FunctionCFG { @@ -262,7 +270,7 @@ impl<'a> FunctionCFG<'a> { .map(|r| mem::transmute::<&qflow_chart_t, &gdl_graph_t>(r)) } - pub fn block_by_id<'b>(&'b self, id: BasicBlockId) -> Option> { + pub fn block_by_id(&self, id: BasicBlockId) -> Option { let blk = unsafe { idalib_qflow_graph_getn_block(self.flow_chart.as_ref().expect("valid pointer"), id) }; @@ -281,7 +289,7 @@ impl<'a> FunctionCFG<'a> { Some(BasicBlock::from_parts(blk, kind)) } - pub fn entry<'b>(&'b self) -> Option> { + pub fn entry(&self) -> Option { let id = unsafe { self.as_gdl_graph().expect("valid pointer").entry() }; if id.0 < 0 { @@ -291,7 +299,7 @@ impl<'a> FunctionCFG<'a> { self.block_by_id(id.0 as _) } - pub fn exit<'b>(&'b self) -> Option> { + pub fn exit(&self) -> Option { let id = unsafe { self.as_gdl_graph().expect("valid pointer").exit() }; if id.0 < 0 { diff --git a/idalib/src/idb.rs b/idalib/src/idb.rs index 0f11efd7e..3fd5b0e00 100644 --- a/idalib/src/idb.rs +++ b/idalib/src/idb.rs @@ -78,7 +78,7 @@ impl IDB { } pub fn set_screen_address(&mut self, ea: Address) { - set_screen_ea(ea.into()) + set_screen_ea(ea.into()); } pub fn make_signatures(&mut self, only_pat: bool) -> Result<(), IDAError> { @@ -89,20 +89,20 @@ impl IDB { self.decompiler } - pub fn meta<'a>(&'a self) -> Metadata<'a> { + pub fn meta(&self) -> Metadata { Metadata::new() } - pub fn meta_mut<'a>(&'a mut self) -> MetadataMut<'a> { + pub fn meta_mut(&mut self) -> MetadataMut { MetadataMut::new() } - pub fn processor<'a>(&'a self) -> Processor<'a> { + pub fn processor(&self) -> Processor { let ptr = unsafe { get_ph() }; Processor::from_ptr(ptr) } - pub fn entries<'a>(&'a self) -> EntryPointIter<'a> { + pub fn entries(&self) -> EntryPointIter { let limit = unsafe { get_entry_qty() }; EntryPointIter { index: 0, @@ -111,7 +111,7 @@ impl IDB { } } - pub fn function_at<'a>(&'a self, ea: Address) -> Option> { + pub fn function_at(&self, ea: Address) -> Option { let ptr = unsafe { get_func(ea.into()) }; if ptr.is_null() { @@ -168,7 +168,7 @@ impl IDB { decompile_func(f.as_ptr(), all_blocks).and_then(CFunction::new) } - pub fn function_by_id<'a>(&'a self, id: FunctionId) -> Option> { + pub fn function_by_id(&self, id: FunctionId) -> Option { let ptr = unsafe { getn_func(id) }; if ptr.is_null() { @@ -186,7 +186,7 @@ impl IDB { unsafe { get_func_qty() } } - pub fn segment_at<'a>(&'a self, ea: Address) -> Option> { + pub fn segment_at(&self, ea: Address) -> Option { let ptr = unsafe { getseg(ea.into()) }; if ptr.is_null() { @@ -196,7 +196,7 @@ impl IDB { Some(Segment::from_ptr(ptr)) } - pub fn segment_by_id<'a>(&'a self, id: SegmentId) -> Option> { + pub fn segment_by_id(&self, id: SegmentId) -> Option { let ptr = unsafe { getnseg((id as i32).into()) }; if ptr.is_null() { @@ -327,7 +327,7 @@ impl IDB { } } - pub fn bookmarks<'a>(&'a self) -> Bookmarks<'a> { + pub fn bookmarks(&self) -> Bookmarks { Bookmarks::new(self) } diff --git a/idalib/src/insn.rs b/idalib/src/insn.rs index 588e9a886..87cc34132 100644 --- a/idalib/src/insn.rs +++ b/idalib/src/insn.rs @@ -125,6 +125,10 @@ impl Insn { self.inner.size as _ } + pub fn is_empty(&self) -> bool { + self.len() == 0 + } + pub fn is_basic_block_end(&self, call_stops_block: bool) -> bool { unsafe { is_basic_block_end(&self.inner, call_stops_block) } } diff --git a/idalib/src/lib.rs b/idalib/src/lib.rs index c651096c2..e6af0d8ae 100644 --- a/idalib/src/lib.rs +++ b/idalib/src/lib.rs @@ -49,5 +49,5 @@ pub(crate) fn prepare_library() -> IDARuntimeHandle { pub fn enable_console_messages(enabled: bool) { init_library(); - ffi::ida::enable_console_messages(enabled) + ffi::ida::enable_console_messages(enabled); } diff --git a/idalib/src/meta.rs b/idalib/src/meta.rs index a5a82cedb..83b4f20ad 100644 --- a/idalib/src/meta.rs +++ b/idalib/src/meta.rs @@ -502,7 +502,7 @@ impl<'a> Metadata<'a> { } pub fn nametype(&self) -> i8 { - unsafe { idalib_inf_get_nametype().into() } + unsafe { idalib_inf_get_nametype() } } pub fn short_demnames(&self) -> u32 { @@ -686,7 +686,7 @@ impl<'a> Metadata<'a> { } pub fn strlit_zeroes(&self) -> i8 { - unsafe { idalib_inf_get_strlit_zeroes().into() } + unsafe { idalib_inf_get_strlit_zeroes() } } pub fn strtype(&self) -> i32 { diff --git a/idalib/src/segment.rs b/idalib/src/segment.rs index 759895be5..3175d3779 100644 --- a/idalib/src/segment.rs +++ b/idalib/src/segment.rs @@ -79,19 +79,23 @@ impl<'a> Segment<'a> { } pub fn start_address(&self) -> Address { - unsafe { (&*self.as_range_t()).start_ea.into() } + unsafe { (*self.as_range_t()).start_ea.into() } } pub fn end_address(&self) -> Address { - unsafe { (&*self.as_range_t()).end_ea.into() } + unsafe { (*self.as_range_t()).end_ea.into() } } pub fn len(&self) -> usize { - unsafe { (&*self.as_range_t()).size().0 as _ } + unsafe { (*self.as_range_t()).size().0 as _ } + } + + pub fn is_empty(&self) -> bool { + self.len() == 0 } pub fn contains_address(&self, addr: Address) -> bool { - unsafe { (&*self.as_range_t()).contains(addr.into()) } + unsafe { (*self.as_range_t()).contains(addr.into()) } } pub fn name(&self) -> Option { @@ -137,46 +141,46 @@ impl<'a> Segment<'a> { } pub fn address_bits(&self) -> u32 { - unsafe { (&*self.ptr).abits().0 as _ } + unsafe { (*self.ptr).abits().0 as _ } } pub fn address_bytes(&self) -> usize { - unsafe { (&*self.ptr).abytes().0 as _ } + unsafe { (*self.ptr).abytes().0 as _ } } pub fn is_16bit(&self) -> bool { - unsafe { (&*self.ptr).is_16bit() } + unsafe { (*self.ptr).is_16bit() } } pub fn is_32bit(&self) -> bool { - unsafe { (&*self.ptr).is_32bit() } + unsafe { (*self.ptr).is_32bit() } } pub fn is_64bit(&self) -> bool { - unsafe { (&*self.ptr).is_64bit() } + unsafe { (*self.ptr).is_64bit() } } pub fn is_hidden(&self) -> bool { - unsafe { (&*self.ptr).is_hidden_segtype() } + unsafe { (*self.ptr).is_hidden_segtype() } } pub fn is_loader(&self) -> bool { - unsafe { (&*self.ptr).is_loader_segm() } + unsafe { (*self.ptr).is_loader_segm() } } pub fn is_header(&self) -> bool { - unsafe { (&*self.ptr).is_header_segm() } + unsafe { (*self.ptr).is_header_segm() } } pub fn is_ephemeral(&self) -> bool { - unsafe { (&*self.ptr).is_ephemeral_segm() } + unsafe { (*self.ptr).is_ephemeral_segm() } } pub fn is_debugger(&self) -> bool { - unsafe { (&*self.ptr).is_debugger_segm() } + unsafe { (*self.ptr).is_debugger_segm() } } pub fn is_visible(&self) -> bool { - unsafe { (&*self.ptr).is_visible_segm() } + unsafe { (*self.ptr).is_visible_segm() } } } diff --git a/idalib/src/xref.rs b/idalib/src/xref.rs index e40e90de6..25b7e8514 100644 --- a/idalib/src/xref.rs +++ b/idalib/src/xref.rs @@ -121,7 +121,7 @@ impl<'a> XRef<'a> { self.inner.user == 1 } - pub fn next_to(&self) -> Option> { + pub fn next_to(&self) -> Option { let mut curr = self.clone(); let found = unsafe { xrefblk_t_next_to(&mut curr.inner as *mut _) }; @@ -133,7 +133,7 @@ impl<'a> XRef<'a> { } } - pub fn next_from(&self) -> Option> { + pub fn next_from(&self) -> Option { let mut curr = self.clone(); let found = unsafe { xrefblk_t_next_from(&mut curr.inner as *mut _) };