diff --git a/secp256k1-sys/Cargo.toml b/secp256k1-sys/Cargo.toml index 203011f..8993a16 100644 --- a/secp256k1-sys/Cargo.toml +++ b/secp256k1-sys/Cargo.toml @@ -13,6 +13,7 @@ keywords = [ "secp256k1", "libsecp256k1", "ffi" ] readme = "README.md" build = "build.rs" links = "rustsecp256k1_v0_5_0" +edition = "2018" # Should make docs.rs show all functions, even those behind non-default features [package.metadata.docs.rs] diff --git a/secp256k1-sys/src/lib.rs b/secp256k1-sys/src/lib.rs index a681f98..d560ea6 100644 --- a/secp256k1-sys/src/lib.rs +++ b/secp256k1-sys/src/lib.rs @@ -17,10 +17,7 @@ //! not be needed for most users. // Coding conventions -#![deny(non_upper_case_globals)] -#![deny(non_camel_case_types)] -#![deny(non_snake_case)] -#![deny(unused_mut)] +#![deny(non_upper_case_globals, non_camel_case_types, non_snake_case, unused_mut)] #![cfg_attr(all(not(test), not(feature = "std")), no_std)] #![cfg_attr(docsrs, feature(doc_cfg))] @@ -31,7 +28,6 @@ extern crate core; #[cfg(fuzzing)] const THIS_UNUSED_CONSTANT_IS_YOUR_WARNING_THAT_ALL_THE_CRYPTO_IN_THIS_LIB_IS_DISABLED_FOR_FUZZING: usize = 0; -#[macro_use] mod macros; pub mod types; diff --git a/secp256k1-sys/src/macros.rs b/secp256k1-sys/src/macros.rs index 47f10df..10d715e 100644 --- a/secp256k1-sys/src/macros.rs +++ b/secp256k1-sys/src/macros.rs @@ -69,14 +69,14 @@ macro_rules! impl_array_newtype { impl PartialOrd for $thing { #[inline] - fn partial_cmp(&self, other: &$thing) -> Option<::core::cmp::Ordering> { + fn partial_cmp(&self, other: &$thing) -> Option { self[..].partial_cmp(&other[..]) } } impl Ord for $thing { #[inline] - fn cmp(&self, other: &$thing) -> ::core::cmp::Ordering { + fn cmp(&self, other: &$thing) -> core::cmp::Ordering { self[..].cmp(&other[..]) } } @@ -89,7 +89,7 @@ macro_rules! impl_array_newtype { } } - impl ::core::ops::Index for $thing { + impl core::ops::Index for $thing { type Output = $ty; #[inline] @@ -99,41 +99,41 @@ macro_rules! impl_array_newtype { } } - impl ::core::ops::Index<::core::ops::Range> for $thing { + impl core::ops::Index> for $thing { type Output = [$ty]; #[inline] - fn index(&self, index: ::core::ops::Range) -> &[$ty] { + fn index(&self, index: core::ops::Range) -> &[$ty] { let &$thing(ref dat) = self; &dat[index] } } - impl ::core::ops::Index<::core::ops::RangeTo> for $thing { + impl core::ops::Index> for $thing { type Output = [$ty]; #[inline] - fn index(&self, index: ::core::ops::RangeTo) -> &[$ty] { + fn index(&self, index: core::ops::RangeTo) -> &[$ty] { let &$thing(ref dat) = self; &dat[index] } } - impl ::core::ops::Index<::core::ops::RangeFrom> for $thing { + impl core::ops::Index> for $thing { type Output = [$ty]; #[inline] - fn index(&self, index: ::core::ops::RangeFrom) -> &[$ty] { + fn index(&self, index: core::ops::RangeFrom) -> &[$ty] { let &$thing(ref dat) = self; &dat[index] } } - impl ::core::ops::Index<::core::ops::RangeFull> for $thing { + impl core::ops::Index for $thing { type Output = [$ty]; #[inline] - fn index(&self, _: ::core::ops::RangeFull) -> &[$ty] { + fn index(&self, _: core::ops::RangeFull) -> &[$ty] { let &$thing(ref dat) = self; &dat[..] } @@ -142,7 +142,7 @@ macro_rules! impl_array_newtype { type Target = $ty; fn as_c_ptr(&self) -> *const Self::Target { if self.is_empty() { - ::core::ptr::null() + core::ptr::null() } else { self.as_ptr() } @@ -150,7 +150,7 @@ macro_rules! impl_array_newtype { fn as_mut_c_ptr(&mut self) -> *mut Self::Target { if self.is_empty() { - ::core::ptr::null::() as *mut _ + core::ptr::null::() as *mut _ } else { self.as_mut_ptr() } @@ -162,8 +162,8 @@ macro_rules! impl_array_newtype { #[macro_export] macro_rules! impl_raw_debug { ($thing:ident) => { - impl ::core::fmt::Debug for $thing { - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { + impl core::fmt::Debug for $thing { + fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { for i in self[..].iter().cloned() { write!(f, "{:02x}", i)?; } diff --git a/secp256k1-sys/src/recovery.rs b/secp256k1-sys/src/recovery.rs index 567f19d..99bb49c 100644 --- a/secp256k1-sys/src/recovery.rs +++ b/secp256k1-sys/src/recovery.rs @@ -15,9 +15,9 @@ //! # FFI of the recovery module -use ::types::*; -use ::core::fmt; -use {Context, Signature, NonceFn, PublicKey, CPtr}; +use crate::{Context, Signature, NonceFn, PublicKey, CPtr, impl_array_newtype}; +use crate::types::*; +use core::fmt; /// Library-internal representation of a Secp256k1 signature + recovery ID #[repr(C)] @@ -98,13 +98,10 @@ extern "C" { #[cfg(fuzzing)] mod fuzz_dummy { - use super::*; - use std::slice; + use core::slice; - use secp256k1_ec_pubkey_create; - use secp256k1_ec_pubkey_parse; - use secp256k1_ec_pubkey_serialize; - use SECP256K1_SER_COMPRESSED; + use crate::{secp256k1_ec_pubkey_create, secp256k1_ec_pubkey_parse, secp256k1_ec_pubkey_serialize, SECP256K1_SER_COMPRESSED}; + use super::*; /// Sets sig to msg32||full pk pub unsafe fn secp256k1_ecdsa_sign_recoverable( @@ -170,6 +167,6 @@ mod fuzz_dummy { 1 } } -#[cfg(fuzzing)] -pub use self::fuzz_dummy::*; +#[cfg(fuzzing)] +pub use self::fuzz_dummy::*; \ No newline at end of file diff --git a/secp256k1-sys/src/types.rs b/secp256k1-sys/src/types.rs index e257d43..e2b9030 100644 --- a/secp256k1-sys/src/types.rs +++ b/secp256k1-sys/src/types.rs @@ -54,7 +54,7 @@ mod tests { use std::any::TypeId; use std::mem; use std::os::raw; - use {types, AlignedType}; + use crate::{types, AlignedType}; #[test] fn verify_types() {