Skip to content

Commit

Permalink
Fix clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
sfackler committed Jul 22, 2020
1 parent 94e70e0 commit 5cf2c2d
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 18 deletions.
24 changes: 12 additions & 12 deletions openssl/src/bn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ impl BigNumRef {
/// OpenSSL documentation at [`BN_div_word`]
///
/// [`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> {
unsafe {
let r = ffi::BN_div_word(self.as_ptr(), w.into());
Expand All @@ -205,7 +205,7 @@ impl BigNumRef {
/// OpenSSL documentation at [`BN_mod_word`]
///
/// [`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> {
unsafe {
let r = ffi::BN_mod_word(self.as_ptr(), w.into());
Expand Down Expand Up @@ -243,7 +243,7 @@ impl BigNumRef {
/// OpenSSL documentation at [`BN_set_bit`]
///
/// [`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> {
unsafe { cvt(ffi::BN_set_bit(self.as_ptr(), n.into())).map(|_| ()) }
}
Expand All @@ -255,7 +255,7 @@ impl BigNumRef {
/// OpenSSL documentation at [`BN_clear_bit`]
///
/// [`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> {
unsafe { cvt(ffi::BN_clear_bit(self.as_ptr(), n.into())).map(|_| ()) }
}
Expand All @@ -265,7 +265,7 @@ impl BigNumRef {
/// 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
#[allow(clippy::identity_conversion)]
#[allow(clippy::useless_conversion)]
pub fn is_bit_set(&self, n: i32) -> bool {
unsafe { ffi::BN_is_bit_set(self.as_ptr(), n.into()) == 1 }
}
Expand All @@ -277,7 +277,7 @@ impl BigNumRef {
/// OpenSSL documentation at [`BN_mask_bits`]
///
/// [`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> {
unsafe { cvt(ffi::BN_mask_bits(self.as_ptr(), n.into())).map(|_| ()) }
}
Expand Down Expand Up @@ -325,7 +325,7 @@ impl BigNumRef {
/// OpenSSL documentation at [`BN_lshift`]
///
/// [`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> {
unsafe { cvt(ffi::BN_lshift(self.as_ptr(), a.as_ptr(), n.into())).map(|_| ()) }
}
Expand All @@ -335,7 +335,7 @@ impl BigNumRef {
/// OpenSSL documentation at [`BN_rshift`]
///
/// [`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> {
unsafe { cvt(ffi::BN_rshift(self.as_ptr(), a.as_ptr(), n.into())).map(|_| ()) }
}
Expand Down Expand Up @@ -421,7 +421,7 @@ impl BigNumRef {
///
/// [`constants`]: index.html#constants
/// [`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> {
unsafe {
cvt(ffi::BN_rand(
Expand All @@ -439,7 +439,7 @@ impl BigNumRef {
/// OpenSSL documentation at [`BN_psuedo_rand`]
///
/// [`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> {
unsafe {
cvt(ffi::BN_pseudo_rand(
Expand Down Expand Up @@ -818,7 +818,7 @@ impl BigNumRef {
/// # Return Value
///
/// 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> {
unsafe {
cvt_n(ffi::BN_is_prime_ex(
Expand All @@ -844,7 +844,7 @@ impl BigNumRef {
/// # Return Value
///
/// 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(
&self,
checks: i32,
Expand Down
2 changes: 1 addition & 1 deletion openssl/src/pkcs5.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ pub struct KeyIvPair {
///
/// New applications should not use this and instead use
/// `pbkdf2_hmac` or another more modern key derivation algorithm.
#[allow(clippy::identity_conversion)]
#[allow(clippy::useless_conversion)]
pub fn bytes_to_key(
cipher: Cipher,
digest: MessageDigest,
Expand Down
10 changes: 5 additions & 5 deletions openssl/src/ssl/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1738,7 +1738,7 @@ impl SslContextBuilder {
/// 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
#[allow(clippy::identity_conversion)]
#[allow(clippy::useless_conversion)]
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() }
}
Expand Down Expand Up @@ -1980,7 +1980,7 @@ impl SslContextRef {
/// 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
#[allow(clippy::identity_conversion)]
#[allow(clippy::useless_conversion)]
pub fn session_cache_size(&self) -> i64 {
unsafe { ffi::SSL_CTX_sess_get_cache_size(self.as_ptr()).into() }
}
Expand Down Expand Up @@ -2098,7 +2098,7 @@ impl SslCipherRef {
/// This corresponds to [`SSL_CIPHER_get_bits`].
///
/// [`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 {
unsafe {
let mut algo_bits = 0;
Expand Down Expand Up @@ -2257,7 +2257,7 @@ impl SslSessionRef {
/// 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
#[allow(clippy::identity_conversion)]
#[allow(clippy::useless_conversion)]
pub fn time(&self) -> i64 {
unsafe { ffi::SSL_SESSION_get_time(self.as_ptr()).into() }
}
Expand All @@ -2269,7 +2269,7 @@ impl SslSessionRef {
/// 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
#[allow(clippy::identity_conversion)]
#[allow(clippy::useless_conversion)]
pub fn timeout(&self) -> i64 {
unsafe { ffi::SSL_SESSION_get_timeout(self.as_ptr()).into() }
}
Expand Down

0 comments on commit 5cf2c2d

Please sign in to comment.