From 788a8b7091bbdde77817030e0836d7a7a786fd99 Mon Sep 17 00:00:00 2001 From: Mason Reed Date: Sun, 4 May 2025 19:47:55 -0400 Subject: [Rust] Simplify usage surrounding c strings `cstring.as_ref().as_ptr() as *const c_char` -> `cstring.as_ptr()` `cstring.as_ref().as_ptr() as *mut _` -> `cstring.as_ptr()` `cstring.as_ptr() as *const c_char` -> `cstring.as_ptr()` With a few fixes for cstrings that might be dropped prematurely. --- rust/src/repository.rs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'rust/src/repository.rs') diff --git a/rust/src/repository.rs b/rust/src/repository.rs index 8d2fbafe..27825b96 100644 --- a/rust/src/repository.rs +++ b/rust/src/repository.rs @@ -54,12 +54,7 @@ impl Repository { pub fn plugin_by_path(&self, path: S) -> Option> { let path = path.to_cstr(); - let result = unsafe { - BNRepositoryGetPluginByPath( - self.handle.as_ptr(), - path.as_ref().as_ptr() as *const c_char, - ) - }; + let result = unsafe { BNRepositoryGetPluginByPath(self.handle.as_ptr(), path.as_ptr()) }; NonNull::new(result).map(|h| unsafe { RepositoryPlugin::ref_from_raw(h) }) } -- cgit v1.3.1