Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix clippy warnings introduced with rust 1.75 #196

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions cryptoki/src/context/session_management.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ use crate::context::Pkcs11;
use crate::error::{Result, Rv};
use crate::session::Session;
use crate::slot::Slot;
use std::convert::TryInto;

impl Pkcs11 {
#[inline(always)]
Expand All @@ -22,7 +21,7 @@ impl Pkcs11 {
};
unsafe {
Rv::from(get_pkcs11!(self, C_OpenSession)(
slot_id.try_into()?,
slot_id.into(),
flags,
// TODO: abstract those types or create new functions for callbacks
std::ptr::null_mut(),
Expand Down
12 changes: 6 additions & 6 deletions cryptoki/src/context/slot_token_management.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ impl Pkcs11 {
let label = label_from_str(label);
unsafe {
Rv::from(get_pkcs11!(self, C_InitToken)(
slot.try_into()?,
slot.into(),
pin.expose_secret().as_ptr() as *mut u8,
pin.expose_secret().len().try_into()?,
label.as_ptr() as *mut u8,
Expand All @@ -101,7 +101,7 @@ impl Pkcs11 {
unsafe {
let mut slot_info = CK_SLOT_INFO::default();
Rv::from(get_pkcs11!(self, C_GetSlotInfo)(
slot.try_into()?,
slot.into(),
&mut slot_info,
))
.into_result()?;
Expand All @@ -114,7 +114,7 @@ impl Pkcs11 {
unsafe {
let mut token_info = CK_TOKEN_INFO::default();
Rv::from(get_pkcs11!(self, C_GetTokenInfo)(
slot.try_into()?,
slot.into(),
&mut token_info,
))
.into_result()?;
Expand All @@ -128,7 +128,7 @@ impl Pkcs11 {

unsafe {
Rv::from(get_pkcs11!(self, C_GetMechanismList)(
slot.try_into()?,
slot.into(),
std::ptr::null_mut(),
&mut mechanism_count,
))
Expand All @@ -139,7 +139,7 @@ impl Pkcs11 {

unsafe {
Rv::from(get_pkcs11!(self, C_GetMechanismList)(
slot.try_into()?,
slot.into(),
mechanisms.as_mut_ptr(),
&mut mechanism_count,
))
Expand All @@ -160,7 +160,7 @@ impl Pkcs11 {
unsafe {
let mut mechanism_info = CK_MECHANISM_INFO::default();
Rv::from(get_pkcs11!(self, C_GetMechanismInfo)(
slot.try_into()?,
slot.into(),
type_.into(),
&mut mechanism_info,
))
Expand Down
4 changes: 2 additions & 2 deletions cryptoki/src/object.rs
Original file line number Diff line number Diff line change
Expand Up @@ -818,10 +818,10 @@ impl TryFrom<CK_ATTRIBUTE> for Attribute {
}
// CK_ULONG
AttributeType::ModulusBits => Ok(Attribute::ModulusBits(
CK_ULONG::from_ne_bytes(val.try_into()?).try_into()?,
CK_ULONG::from_ne_bytes(val.try_into()?).into(),
)),
AttributeType::ValueLen => Ok(Attribute::ValueLen(
CK_ULONG::from_ne_bytes(val.try_into()?).try_into()?,
CK_ULONG::from_ne_bytes(val.try_into()?).into(),
)),
// Vec<u8>
AttributeType::AcIssuer => Ok(Attribute::AcIssuer(val.to_vec())),
Expand Down
2 changes: 1 addition & 1 deletion cryptoki/src/session/random.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ impl Session {
Rv::from(get_pkcs11!(self.client(), C_GenerateRandom)(
self.handle(),
result.as_mut_ptr(),
random_len.try_into()?,
random_len.into(),
))
.into_result()?;
}
Expand Down
2 changes: 1 addition & 1 deletion cryptoki/src/slot/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ impl TryFrom<u32> for Slot {

fn try_from(slot_id: u32) -> Result<Self> {
Ok(Self {
slot_id: slot_id.try_into()?,
slot_id: slot_id.into(),
})
}
}
Expand Down
Loading