Fix clippy

This commit is contained in:
Steven Fackler 2020-07-22 14:18:30 -06:00
parent 94e70e09ea
commit 5cf2c2d5f0
3 changed files with 18 additions and 18 deletions

View File

@ -188,7 +188,7 @@ impl BigNumRef {
/// OpenSSL documentation at [`BN_div_word`] /// OpenSSL documentation at [`BN_div_word`]
/// ///
/// [`BN_div_word`]: https://www.openssl.org/docs/man1.1.0/crypto/BN_div_word.html /// [`BN_div_word`]: https://www.openssl.org/docs/man1.1.0/crypto/BN_div_word.html
#[allow(clippy::identity_conversion)] #[allow(clippy::useless_conversion)]
pub fn div_word(&mut self, w: u32) -> Result<u64, ErrorStack> { pub fn div_word(&mut self, w: u32) -> Result<u64, ErrorStack> {
unsafe { unsafe {
let r = ffi::BN_div_word(self.as_ptr(), w.into()); let r = ffi::BN_div_word(self.as_ptr(), w.into());
@ -205,7 +205,7 @@ impl BigNumRef {
/// OpenSSL documentation at [`BN_mod_word`] /// OpenSSL documentation at [`BN_mod_word`]
/// ///
/// [`BN_mod_word`]: https://www.openssl.org/docs/man1.1.0/crypto/BN_mod_word.html /// [`BN_mod_word`]: https://www.openssl.org/docs/man1.1.0/crypto/BN_mod_word.html
#[allow(clippy::identity_conversion)] #[allow(clippy::useless_conversion)]
pub fn mod_word(&self, w: u32) -> Result<u64, ErrorStack> { pub fn mod_word(&self, w: u32) -> Result<u64, ErrorStack> {
unsafe { unsafe {
let r = ffi::BN_mod_word(self.as_ptr(), w.into()); let r = ffi::BN_mod_word(self.as_ptr(), w.into());
@ -243,7 +243,7 @@ impl BigNumRef {
/// OpenSSL documentation at [`BN_set_bit`] /// OpenSSL documentation at [`BN_set_bit`]
/// ///
/// [`BN_set_bit`]: https://www.openssl.org/docs/man1.1.0/crypto/BN_set_bit.html /// [`BN_set_bit`]: https://www.openssl.org/docs/man1.1.0/crypto/BN_set_bit.html
#[allow(clippy::identity_conversion)] #[allow(clippy::useless_conversion)]
pub fn set_bit(&mut self, n: i32) -> Result<(), ErrorStack> { pub fn set_bit(&mut self, n: i32) -> Result<(), ErrorStack> {
unsafe { cvt(ffi::BN_set_bit(self.as_ptr(), n.into())).map(|_| ()) } unsafe { cvt(ffi::BN_set_bit(self.as_ptr(), n.into())).map(|_| ()) }
} }
@ -255,7 +255,7 @@ impl BigNumRef {
/// OpenSSL documentation at [`BN_clear_bit`] /// OpenSSL documentation at [`BN_clear_bit`]
/// ///
/// [`BN_clear_bit`]: https://www.openssl.org/docs/man1.1.0/crypto/BN_clear_bit.html /// [`BN_clear_bit`]: https://www.openssl.org/docs/man1.1.0/crypto/BN_clear_bit.html
#[allow(clippy::identity_conversion)] #[allow(clippy::useless_conversion)]
pub fn clear_bit(&mut self, n: i32) -> Result<(), ErrorStack> { pub fn clear_bit(&mut self, n: i32) -> Result<(), ErrorStack> {
unsafe { cvt(ffi::BN_clear_bit(self.as_ptr(), n.into())).map(|_| ()) } unsafe { cvt(ffi::BN_clear_bit(self.as_ptr(), n.into())).map(|_| ()) }
} }
@ -265,7 +265,7 @@ impl BigNumRef {
/// OpenSSL documentation at [`BN_is_bit_set`] /// OpenSSL documentation at [`BN_is_bit_set`]
/// ///
/// [`BN_is_bit_set`]: https://www.openssl.org/docs/man1.1.0/crypto/BN_is_bit_set.html /// [`BN_is_bit_set`]: https://www.openssl.org/docs/man1.1.0/crypto/BN_is_bit_set.html
#[allow(clippy::identity_conversion)] #[allow(clippy::useless_conversion)]
pub fn is_bit_set(&self, n: i32) -> bool { pub fn is_bit_set(&self, n: i32) -> bool {
unsafe { ffi::BN_is_bit_set(self.as_ptr(), n.into()) == 1 } unsafe { ffi::BN_is_bit_set(self.as_ptr(), n.into()) == 1 }
} }
@ -277,7 +277,7 @@ impl BigNumRef {
/// OpenSSL documentation at [`BN_mask_bits`] /// OpenSSL documentation at [`BN_mask_bits`]
/// ///
/// [`BN_mask_bits`]: https://www.openssl.org/docs/man1.1.0/crypto/BN_mask_bits.html /// [`BN_mask_bits`]: https://www.openssl.org/docs/man1.1.0/crypto/BN_mask_bits.html
#[allow(clippy::identity_conversion)] #[allow(clippy::useless_conversion)]
pub fn mask_bits(&mut self, n: i32) -> Result<(), ErrorStack> { pub fn mask_bits(&mut self, n: i32) -> Result<(), ErrorStack> {
unsafe { cvt(ffi::BN_mask_bits(self.as_ptr(), n.into())).map(|_| ()) } unsafe { cvt(ffi::BN_mask_bits(self.as_ptr(), n.into())).map(|_| ()) }
} }
@ -325,7 +325,7 @@ impl BigNumRef {
/// OpenSSL documentation at [`BN_lshift`] /// OpenSSL documentation at [`BN_lshift`]
/// ///
/// [`BN_lshift`]: https://www.openssl.org/docs/man1.1.0/crypto/BN_lshift.html /// [`BN_lshift`]: https://www.openssl.org/docs/man1.1.0/crypto/BN_lshift.html
#[allow(clippy::identity_conversion)] #[allow(clippy::useless_conversion)]
pub fn lshift(&mut self, a: &BigNumRef, n: i32) -> Result<(), ErrorStack> { pub fn lshift(&mut self, a: &BigNumRef, n: i32) -> Result<(), ErrorStack> {
unsafe { cvt(ffi::BN_lshift(self.as_ptr(), a.as_ptr(), n.into())).map(|_| ()) } unsafe { cvt(ffi::BN_lshift(self.as_ptr(), a.as_ptr(), n.into())).map(|_| ()) }
} }
@ -335,7 +335,7 @@ impl BigNumRef {
/// OpenSSL documentation at [`BN_rshift`] /// OpenSSL documentation at [`BN_rshift`]
/// ///
/// [`BN_rshift`]: https://www.openssl.org/docs/man1.1.0/crypto/BN_rshift.html /// [`BN_rshift`]: https://www.openssl.org/docs/man1.1.0/crypto/BN_rshift.html
#[allow(clippy::identity_conversion)] #[allow(clippy::useless_conversion)]
pub fn rshift(&mut self, a: &BigNumRef, n: i32) -> Result<(), ErrorStack> { pub fn rshift(&mut self, a: &BigNumRef, n: i32) -> Result<(), ErrorStack> {
unsafe { cvt(ffi::BN_rshift(self.as_ptr(), a.as_ptr(), n.into())).map(|_| ()) } unsafe { cvt(ffi::BN_rshift(self.as_ptr(), a.as_ptr(), n.into())).map(|_| ()) }
} }
@ -421,7 +421,7 @@ impl BigNumRef {
/// ///
/// [`constants`]: index.html#constants /// [`constants`]: index.html#constants
/// [`BN_rand`]: https://www.openssl.org/docs/man1.1.0/crypto/BN_rand.html /// [`BN_rand`]: https://www.openssl.org/docs/man1.1.0/crypto/BN_rand.html
#[allow(clippy::identity_conversion)] #[allow(clippy::useless_conversion)]
pub fn rand(&mut self, bits: i32, msb: MsbOption, odd: bool) -> Result<(), ErrorStack> { pub fn rand(&mut self, bits: i32, msb: MsbOption, odd: bool) -> Result<(), ErrorStack> {
unsafe { unsafe {
cvt(ffi::BN_rand( cvt(ffi::BN_rand(
@ -439,7 +439,7 @@ impl BigNumRef {
/// OpenSSL documentation at [`BN_psuedo_rand`] /// OpenSSL documentation at [`BN_psuedo_rand`]
/// ///
/// [`BN_psuedo_rand`]: https://www.openssl.org/docs/man1.1.0/crypto/BN_pseudo_rand.html /// [`BN_psuedo_rand`]: https://www.openssl.org/docs/man1.1.0/crypto/BN_pseudo_rand.html
#[allow(clippy::identity_conversion)] #[allow(clippy::useless_conversion)]
pub fn pseudo_rand(&mut self, bits: i32, msb: MsbOption, odd: bool) -> Result<(), ErrorStack> { pub fn pseudo_rand(&mut self, bits: i32, msb: MsbOption, odd: bool) -> Result<(), ErrorStack> {
unsafe { unsafe {
cvt(ffi::BN_pseudo_rand( cvt(ffi::BN_pseudo_rand(
@ -818,7 +818,7 @@ impl BigNumRef {
/// # Return Value /// # Return Value
/// ///
/// Returns `true` if `self` is prime with an error probability of less than `0.25 ^ checks`. /// Returns `true` if `self` is prime with an error probability of less than `0.25 ^ checks`.
#[allow(clippy::identity_conversion)] #[allow(clippy::useless_conversion)]
pub fn is_prime(&self, checks: i32, ctx: &mut BigNumContextRef) -> Result<bool, ErrorStack> { pub fn is_prime(&self, checks: i32, ctx: &mut BigNumContextRef) -> Result<bool, ErrorStack> {
unsafe { unsafe {
cvt_n(ffi::BN_is_prime_ex( cvt_n(ffi::BN_is_prime_ex(
@ -844,7 +844,7 @@ impl BigNumRef {
/// # Return Value /// # Return Value
/// ///
/// Returns `true` if `self` is prime with an error probability of less than `0.25 ^ checks`. /// Returns `true` if `self` is prime with an error probability of less than `0.25 ^ checks`.
#[allow(clippy::identity_conversion)] #[allow(clippy::useless_conversion)]
pub fn is_prime_fasttest( pub fn is_prime_fasttest(
&self, &self,
checks: i32, checks: i32,

View File

@ -23,7 +23,7 @@ pub struct KeyIvPair {
/// ///
/// New applications should not use this and instead use /// New applications should not use this and instead use
/// `pbkdf2_hmac` or another more modern key derivation algorithm. /// `pbkdf2_hmac` or another more modern key derivation algorithm.
#[allow(clippy::identity_conversion)] #[allow(clippy::useless_conversion)]
pub fn bytes_to_key( pub fn bytes_to_key(
cipher: Cipher, cipher: Cipher,
digest: MessageDigest, digest: MessageDigest,

View File

@ -1738,7 +1738,7 @@ impl SslContextBuilder {
/// This corresponds to [`SSL_CTX_sess_get_cache_size`]. /// This corresponds to [`SSL_CTX_sess_get_cache_size`].
/// ///
/// [`SSL_CTX_sess_get_cache_size`]: https://www.openssl.org/docs/man1.0.2/man3/SSL_CTX_sess_set_cache_size.html /// [`SSL_CTX_sess_get_cache_size`]: https://www.openssl.org/docs/man1.0.2/man3/SSL_CTX_sess_set_cache_size.html
#[allow(clippy::identity_conversion)] #[allow(clippy::useless_conversion)]
pub fn set_session_cache_size(&mut self, size: i32) -> i64 { pub fn set_session_cache_size(&mut self, size: i32) -> i64 {
unsafe { ffi::SSL_CTX_sess_set_cache_size(self.as_ptr(), size.into()).into() } unsafe { ffi::SSL_CTX_sess_set_cache_size(self.as_ptr(), size.into()).into() }
} }
@ -1980,7 +1980,7 @@ impl SslContextRef {
/// This corresponds to [`SSL_CTX_sess_get_cache_size`]. /// This corresponds to [`SSL_CTX_sess_get_cache_size`].
/// ///
/// [`SSL_CTX_sess_get_cache_size`]: https://www.openssl.org/docs/man1.0.2/man3/SSL_CTX_sess_set_cache_size.html /// [`SSL_CTX_sess_get_cache_size`]: https://www.openssl.org/docs/man1.0.2/man3/SSL_CTX_sess_set_cache_size.html
#[allow(clippy::identity_conversion)] #[allow(clippy::useless_conversion)]
pub fn session_cache_size(&self) -> i64 { pub fn session_cache_size(&self) -> i64 {
unsafe { ffi::SSL_CTX_sess_get_cache_size(self.as_ptr()).into() } unsafe { ffi::SSL_CTX_sess_get_cache_size(self.as_ptr()).into() }
} }
@ -2098,7 +2098,7 @@ impl SslCipherRef {
/// This corresponds to [`SSL_CIPHER_get_bits`]. /// This corresponds to [`SSL_CIPHER_get_bits`].
/// ///
/// [`SSL_CIPHER_get_bits`]: https://www.openssl.org/docs/manmaster/man3/SSL_CIPHER_get_name.html /// [`SSL_CIPHER_get_bits`]: https://www.openssl.org/docs/manmaster/man3/SSL_CIPHER_get_name.html
#[allow(clippy::identity_conversion)] #[allow(clippy::useless_conversion)]
pub fn bits(&self) -> CipherBits { pub fn bits(&self) -> CipherBits {
unsafe { unsafe {
let mut algo_bits = 0; let mut algo_bits = 0;
@ -2257,7 +2257,7 @@ impl SslSessionRef {
/// This corresponds to [`SSL_SESSION_get_time`]. /// This corresponds to [`SSL_SESSION_get_time`].
/// ///
/// [`SSL_SESSION_get_time`]: https://www.openssl.org/docs/man1.1.1/man3/SSL_SESSION_get_time.html /// [`SSL_SESSION_get_time`]: https://www.openssl.org/docs/man1.1.1/man3/SSL_SESSION_get_time.html
#[allow(clippy::identity_conversion)] #[allow(clippy::useless_conversion)]
pub fn time(&self) -> i64 { pub fn time(&self) -> i64 {
unsafe { ffi::SSL_SESSION_get_time(self.as_ptr()).into() } unsafe { ffi::SSL_SESSION_get_time(self.as_ptr()).into() }
} }
@ -2269,7 +2269,7 @@ impl SslSessionRef {
/// This corresponds to [`SSL_SESSION_get_timeout`]. /// This corresponds to [`SSL_SESSION_get_timeout`].
/// ///
/// [`SSL_SESSION_get_timeout`]: https://www.openssl.org/docs/man1.1.1/man3/SSL_SESSION_get_time.html /// [`SSL_SESSION_get_timeout`]: https://www.openssl.org/docs/man1.1.1/man3/SSL_SESSION_get_time.html
#[allow(clippy::identity_conversion)] #[allow(clippy::useless_conversion)]
pub fn timeout(&self) -> i64 { pub fn timeout(&self) -> i64 {
unsafe { ffi::SSL_SESSION_get_timeout(self.as_ptr()).into() } unsafe { ffi::SSL_SESSION_get_timeout(self.as_ptr()).into() }
} }