Remove attributes which are failing compilation
- Remove must_use on functions which return (). The latest version
of nightly actually enforces this; it didn't before.
- Remove use of the unstable tool_lints feature so we compile on
stable
Change-Id: Ic2843c8480c9d51f78babacc89afcf49d51e9598
diff --git a/src/boringssl/mod.rs b/src/boringssl/mod.rs
index 2327577..aa9876a 100644
--- a/src/boringssl/mod.rs
+++ b/src/boringssl/mod.rs
@@ -218,7 +218,9 @@
/// The `EC_KEY_get0_group` function.
#[must_use]
- #[allow(clippy::needless_lifetimes)] // to be more explicit
+ // TODO(joshlf): Replace with #[allow(clippy::needless_lifetimes)] once the
+ // tool_lints feature is stable
+ #[cfg_attr(feature = "cargo-clippy", allow(clippy::needless_lifetimes))] // to be more explicit
pub fn ec_key_get0_group<'a>(&'a self) -> Result<CRef<'a, EC_GROUP>, BoringError> {
// get0 doesn't increment the refcount; the lifetimes ensure that the
// returned CRef can't outlive self
@@ -354,7 +356,6 @@
}
/// The `EVP_PKEY_assign_EC_KEY` function.
- #[must_use]
pub fn evp_pkey_assign_ec_key(&mut self, ec_key: CHeapWrapper<EC_KEY>) {
unsafe {
// NOTE: It's very important that we use 'into_mut' here so that
@@ -494,7 +495,6 @@
}
/// The `HMAC_Update` function.
- #[must_use]
pub fn hmac_update(&mut self, data: &[u8]) {
unsafe { HMAC_Update(self.as_mut(), data.as_ptr(), data.len()) }
}
@@ -508,7 +508,6 @@
///
/// `hmac_final` panics if `out` is not exactly the right length (as defined
/// by `HMAC_size`).
- #[must_use]
pub fn hmac_final(&mut self, out: &mut [u8]) {
unsafe {
let size = HMAC_size(self.as_const());
@@ -732,7 +731,7 @@
#[test]
fn test_boring_error() {
- CStackWrapper::cbs_with_temp_buffer(&[], |cbs| {
+ let _ = CStackWrapper::cbs_with_temp_buffer(&[], |cbs| {
should_fail(
CHeapWrapper::evp_parse_public_key(cbs),
"boringssl::EVP_parse_public_key",
diff --git a/src/boringssl/raw.rs b/src/boringssl/raw.rs
index 76ea6db..c09bbd2 100644
--- a/src/boringssl/raw.rs
+++ b/src/boringssl/raw.rs
@@ -236,7 +236,9 @@
}
#[allow(non_snake_case)]
-#[allow(clippy::too_many_arguments)]
+// TODO(joshlf): Replace with #[allow(clippy::too_many_arguments)] once the
+// tool_lints feature is stable
+#[cfg_attr(feature = "cargo-clippy", allow(clippy::too_many_arguments))]
#[must_use]
pub unsafe fn EVP_PBE_scrypt(
password: *const c_char, password_len: usize, salt: *const u8, salt_len: usize, N: u64, r: u64,
@@ -261,7 +263,9 @@
#[cfg(feature = "kdf")]
#[allow(non_snake_case)]
-#[allow(clippy::too_many_arguments)]
+// TODO(joshlf): Replace with #[allow(clippy::too_many_arguments)] once the
+// tool_lints feature is stable
+#[cfg_attr(feature = "cargo-clippy", allow(clippy::too_many_arguments))]
#[must_use]
pub unsafe fn PKCS5_PBKDF2_HMAC(
password: *const c_char, password_len: usize, salt: *const u8, salt_len: usize,
@@ -304,7 +308,6 @@
}
#[allow(non_snake_case)]
-#[must_use]
pub unsafe fn HMAC_Update(ctx: *mut HMAC_CTX, data: *const u8, data_len: usize) {
// HMAC_Update promises to return 1.
assert_abort_eq!(ffi::HMAC_Update(ctx, data, data_len), 1);
@@ -321,7 +324,6 @@
// rand.h
#[allow(non_snake_case)]
-#[must_use]
pub unsafe fn RAND_bytes(buf: *mut u8, len: usize) {
// RAND_bytes promises to return 1.
assert_abort_eq!(ffi::RAND_bytes(buf, len), 1);
@@ -330,7 +332,6 @@
// sha.h
#[allow(non_snake_case)]
-#[must_use]
pub unsafe fn SHA384_Init(ctx: *mut SHA512_CTX) {
// SHA384_Init promises to return 1.
assert_abort_eq!(ffi::SHA384_Init(ctx), 1);
diff --git a/src/kdf.rs b/src/kdf.rs
index 0d48ee8..97d5a07 100644
--- a/src/kdf.rs
+++ b/src/kdf.rs
@@ -39,7 +39,6 @@
///
/// [RFC 2898 Section 5.2]: https://tools.ietf.org/html/rfc2898#section-5.2
/// [RFC 2898 Appendix B.1]: https://tools.ietf.org/html/rfc2898#appendix-B.1
-#[must_use]
pub fn pbkdf2<H: Hasher>(password: &[u8], salt: &[u8], iters: NonZeroU32, out_key: &mut [u8]) {
// PKCS5_PBKDF2_HMAC can only fail on OOM or if iters is 0.
boringssl::pkcs5_pbkdf2_hmac(password, salt, iters.get(), &H::evp_md(), out_key).unwrap();
@@ -81,7 +80,6 @@
///
/// [RFC 2898 Section 5.2]: https://tools.ietf.org/html/rfc2898#section-5.2
/// [RFC 2898 Appendix B.1]: https://tools.ietf.org/html/rfc2898#appendix-B.1
- #[must_use]
#[deprecated(note = "PBKDF2-HMAC-SHA1 is considered insecure")]
pub fn insecure_pbkdf2_hmac_sha1(
password: &[u8], salt: &[u8], iters: NonZeroU32, out_key: &mut [u8],
diff --git a/src/lib.rs b/src/lib.rs
index 6caf2ea..3eb558f 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -43,8 +43,6 @@
#![doc(html_root_url = "https://docs.rs/mundane/0.2.0")]
#![deny(missing_docs)]
#![deny(warnings)]
-#![feature(tool_lints)]
-#![allow(stable_features)]
// just in case we forget to add #[forbid(unsafe_code)] on new module
// definitions
#![deny(unsafe_code)]