diff options
| author | Mason Reed <mason@vector35.com> | 2025-05-04 19:47:55 -0400 |
|---|---|---|
| committer | Mason Reed <35282038+emesare@users.noreply.github.com> | 2025-05-12 17:45:24 -0400 |
| commit | 788a8b7091bbdde77817030e0836d7a7a786fd99 (patch) | |
| tree | 40e8f8d3c870788259a5acb5d14995cdc1656979 /rust/src/component.rs | |
| parent | a826c589dfc10c542deba7ca3343a462e02d6bde (diff) | |
[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.
Diffstat (limited to 'rust/src/component.rs')
| -rw-r--r-- | rust/src/component.rs | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/rust/src/component.rs b/rust/src/component.rs index 5fe44b64..48c8b110 100644 --- a/rust/src/component.rs +++ b/rust/src/component.rs @@ -166,12 +166,7 @@ impl Component { pub fn set_name<S: AsCStr>(&self, name: S) { let name = name.to_cstr(); - unsafe { - BNComponentSetName( - self.handle.as_ptr(), - name.as_ref().as_ptr() as *const c_char, - ) - } + unsafe { BNComponentSetName(self.handle.as_ptr(), name.as_ptr()) } } /// The component that contains this component, if it exists. |
