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/collaboration/changeset.rs | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'rust/src/collaboration/changeset.rs') diff --git a/rust/src/collaboration/changeset.rs b/rust/src/collaboration/changeset.rs index 1cc30d76..0db384cb 100644 --- a/rust/src/collaboration/changeset.rs +++ b/rust/src/collaboration/changeset.rs @@ -1,5 +1,4 @@ use binaryninjacore_sys::*; -use std::ffi::c_char; use std::ptr::NonNull; use super::{RemoteFile, RemoteUser}; @@ -68,12 +67,7 @@ impl Changeset { /// Set the name of the changeset, e.g. in a name changeset function. pub fn set_name(&self, value: S) -> bool { let value = value.to_cstr(); - unsafe { - BNCollaborationChangesetSetName( - self.handle.as_ptr(), - value.as_ref().as_ptr() as *const c_char, - ) - } + unsafe { BNCollaborationChangesetSetName(self.handle.as_ptr(), value.as_ptr()) } } } -- cgit v1.3.1