Fix clippy and track in CI

`flake check` will run clippy.
This commit is contained in:
John Ericson 2025-12-15 19:48:30 -05:00
parent 654addc555
commit 351a206776
13 changed files with 82 additions and 50 deletions

View file

@ -1,6 +1,5 @@
use anyhow::{bail, Result};
use nix_bindings_bindgen_raw as raw;
use std::os::raw::c_char;
use std::ptr::null_mut;
use std::ptr::NonNull;
@ -11,6 +10,12 @@ pub struct Context {
inner: NonNull<raw::c_context>,
}
impl Default for Context {
fn default() -> Self {
Self::new()
}
}
impl Context {
pub fn new() -> Self {
let ctx = unsafe { raw::c_context_create() };
@ -48,11 +53,7 @@ impl Context {
pub fn clear(&mut self) {
unsafe {
raw::set_err_msg(
self.inner.as_ptr(),
raw::err_NIX_OK,
b"\0".as_ptr() as *const c_char,
);
raw::set_err_msg(self.inner.as_ptr(), raw::err_NIX_OK, c"".as_ptr());
}
}
@ -143,8 +144,8 @@ mod tests {
unsafe {
raw::set_err_msg(
ctx_ptr,
raw::err_NIX_ERR_UNKNOWN.try_into().unwrap(),
b"dummy error message\0".as_ptr() as *const std::os::raw::c_char,
raw::err_NIX_ERR_UNKNOWN,
c"dummy error message".as_ptr(),
);
}
}