Merge pull request #260 from tcharding/clippy

Clear clippy warnings
This commit is contained in:
Andrew Poelstra 2020-12-22 02:18:24 +00:00 committed by GitHub
commit 1a818ea099
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 11 deletions

View File

@ -43,6 +43,7 @@ pub const SECP256K1_START_VERIFY: c_uint = 1 | (1 << 8);
/// Flag for context to enable signing precomputation
pub const SECP256K1_START_SIGN: c_uint = 1 | (1 << 9);
/// Flag for keys to indicate uncompressed serialization format
#[allow(unused_parens)]
pub const SECP256K1_SER_UNCOMPRESSED: c_uint = (1 << 1);
/// Flag for keys to indicate compressed serialization format
pub const SECP256K1_SER_COMPRESSED: c_uint = (1 << 1) | (1 << 8);
@ -629,7 +630,8 @@ pub unsafe extern "C" fn rustsecp256k1_v0_3_1_default_error_callback_fn(message:
panic!("[libsecp256k1] internal consistency check failed {}", msg);
}
#[no_mangle]
#[cfg(not(feature = "external-symbols"))]
unsafe fn strlen(mut str_ptr: *const c_char) -> usize {
let mut ctr = 0;
while *str_ptr != '\0' as c_char {
@ -1160,11 +1162,13 @@ pub use self::fuzz_dummy::*;
#[cfg(test)]
mod tests {
use std::ffi::CString;
use super::strlen;
#[no_mangle]
#[cfg(not(feature = "external-symbols"))]
#[test]
fn test_strlen() {
use std::ffi::CString;
use super::strlen;
let orig = "test strlen \t \n";
let test = CString::new(orig).unwrap();

View File

@ -34,13 +34,6 @@ macro_rules! impl_array_newtype {
dat.as_mut_ptr()
}
#[inline]
/// Gets a reference to the underlying array
pub fn as_ref(&self) -> &[$ty; $len] {
let &$thing(ref dat) = self;
dat
}
#[inline]
/// Returns the length of the object as an array
pub fn len(&self) -> usize { $len }
@ -50,6 +43,15 @@ macro_rules! impl_array_newtype {
pub fn is_empty(&self) -> bool { false }
}
impl AsRef<[$ty; $len]> for $thing {
#[inline]
/// Gets a reference to the underlying array
fn as_ref(&self) -> &[$ty; $len] {
let &$thing(ref dat) = self;
dat
}
}
impl PartialEq for $thing {
#[inline]
fn eq(&self, other: &$thing) -> bool {

View File

@ -40,6 +40,7 @@ impl AlignedType {
}
}
#[cfg(all(feature = "std", not(feature = "external-symbols")))]
pub(crate) const ALIGN_TO: usize = mem::align_of::<AlignedType>();