Skip to content

Commit

Permalink
Fix linting
Browse files Browse the repository at this point in the history
  • Loading branch information
KendallWeihe committed Sep 27, 2024
1 parent d79a9e2 commit 76ade28
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
3 changes: 2 additions & 1 deletion Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ test: setup
cargo test --workspace

lint: setup
cargo clippy --workspace
cargo clippy --workspace --exclude web5_c
cargo clippy --package web5_c -- -A clippy::not_unsafe_ptr_arg_deref
cargo fmt

bind: setup
Expand Down
4 changes: 2 additions & 2 deletions bindings/web5_c/src/c.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ pub fn free_bytes(ptr: *mut u8) {
}
}

pub unsafe fn opt_cstr_to_string(c_str: *const c_char) -> Option<String> {
pub fn opt_cstr_to_string(c_str: *const c_char) -> Option<String> {
if c_str.is_null() {
None
} else {
Some(CStr::from_ptr(c_str).to_string_lossy().into_owned())
Some(unsafe { CStr::from_ptr(c_str).to_string_lossy().into_owned() })
}
}

Expand Down
6 changes: 3 additions & 3 deletions bindings/web5_c/src/crypto/jwk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,12 @@ pub extern "C" fn free_cjwk(jwk: *mut CJwk) {
impl From<&CJwk> for Jwk {
fn from(jwk_c: &CJwk) -> Self {
Jwk {
alg: unsafe { opt_cstr_to_string(jwk_c.alg) },
alg: opt_cstr_to_string(jwk_c.alg),
kty: unsafe { CStr::from_ptr(jwk_c.kty).to_string_lossy().into_owned() },
crv: unsafe { CStr::from_ptr(jwk_c.crv).to_string_lossy().into_owned() },
d: unsafe { opt_cstr_to_string(jwk_c.d) },
d: opt_cstr_to_string(jwk_c.d),
x: unsafe { CStr::from_ptr(jwk_c.x).to_string_lossy().into_owned() },
y: unsafe { opt_cstr_to_string(jwk_c.y) },
y: opt_cstr_to_string(jwk_c.y),
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion bindings/web5_c/src/crypto/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pub mod dsa;
pub mod key_managers;

pub mod jwk;
pub mod jwk;

0 comments on commit 76ade28

Please sign in to comment.