Update secp256k1-sys to edition 2018 and fix imports

This commit is contained in:
Elichai Turkel 2021-09-14 16:31:22 +03:00
parent ebe46a4d4e
commit 26a52bc8c8
No known key found for this signature in database
GPG Key ID: 9383CDE9E8E66A7F
5 changed files with 26 additions and 32 deletions

View File

@ -13,6 +13,7 @@ keywords = [ "secp256k1", "libsecp256k1", "ffi" ]
readme = "README.md" readme = "README.md"
build = "build.rs" build = "build.rs"
links = "rustsecp256k1_v0_5_0" links = "rustsecp256k1_v0_5_0"
edition = "2018"
# Should make docs.rs show all functions, even those behind non-default features # Should make docs.rs show all functions, even those behind non-default features
[package.metadata.docs.rs] [package.metadata.docs.rs]

View File

@ -17,10 +17,7 @@
//! not be needed for most users. //! not be needed for most users.
// Coding conventions // Coding conventions
#![deny(non_upper_case_globals)] #![deny(non_upper_case_globals, non_camel_case_types, non_snake_case, unused_mut)]
#![deny(non_camel_case_types)]
#![deny(non_snake_case)]
#![deny(unused_mut)]
#![cfg_attr(all(not(test), not(feature = "std")), no_std)] #![cfg_attr(all(not(test), not(feature = "std")), no_std)]
#![cfg_attr(docsrs, feature(doc_cfg))] #![cfg_attr(docsrs, feature(doc_cfg))]
@ -31,7 +28,6 @@ extern crate core;
#[cfg(fuzzing)] #[cfg(fuzzing)]
const THIS_UNUSED_CONSTANT_IS_YOUR_WARNING_THAT_ALL_THE_CRYPTO_IN_THIS_LIB_IS_DISABLED_FOR_FUZZING: usize = 0; const THIS_UNUSED_CONSTANT_IS_YOUR_WARNING_THAT_ALL_THE_CRYPTO_IN_THIS_LIB_IS_DISABLED_FOR_FUZZING: usize = 0;
#[macro_use]
mod macros; mod macros;
pub mod types; pub mod types;

View File

@ -69,14 +69,14 @@ macro_rules! impl_array_newtype {
impl PartialOrd for $thing { impl PartialOrd for $thing {
#[inline] #[inline]
fn partial_cmp(&self, other: &$thing) -> Option<::core::cmp::Ordering> { fn partial_cmp(&self, other: &$thing) -> Option<core::cmp::Ordering> {
self[..].partial_cmp(&other[..]) self[..].partial_cmp(&other[..])
} }
} }
impl Ord for $thing { impl Ord for $thing {
#[inline] #[inline]
fn cmp(&self, other: &$thing) -> ::core::cmp::Ordering { fn cmp(&self, other: &$thing) -> core::cmp::Ordering {
self[..].cmp(&other[..]) self[..].cmp(&other[..])
} }
} }
@ -89,7 +89,7 @@ macro_rules! impl_array_newtype {
} }
} }
impl ::core::ops::Index<usize> for $thing { impl core::ops::Index<usize> for $thing {
type Output = $ty; type Output = $ty;
#[inline] #[inline]
@ -99,41 +99,41 @@ macro_rules! impl_array_newtype {
} }
} }
impl ::core::ops::Index<::core::ops::Range<usize>> for $thing { impl core::ops::Index<core::ops::Range<usize>> for $thing {
type Output = [$ty]; type Output = [$ty];
#[inline] #[inline]
fn index(&self, index: ::core::ops::Range<usize>) -> &[$ty] { fn index(&self, index: core::ops::Range<usize>) -> &[$ty] {
let &$thing(ref dat) = self; let &$thing(ref dat) = self;
&dat[index] &dat[index]
} }
} }
impl ::core::ops::Index<::core::ops::RangeTo<usize>> for $thing { impl core::ops::Index<core::ops::RangeTo<usize>> for $thing {
type Output = [$ty]; type Output = [$ty];
#[inline] #[inline]
fn index(&self, index: ::core::ops::RangeTo<usize>) -> &[$ty] { fn index(&self, index: core::ops::RangeTo<usize>) -> &[$ty] {
let &$thing(ref dat) = self; let &$thing(ref dat) = self;
&dat[index] &dat[index]
} }
} }
impl ::core::ops::Index<::core::ops::RangeFrom<usize>> for $thing { impl core::ops::Index<core::ops::RangeFrom<usize>> for $thing {
type Output = [$ty]; type Output = [$ty];
#[inline] #[inline]
fn index(&self, index: ::core::ops::RangeFrom<usize>) -> &[$ty] { fn index(&self, index: core::ops::RangeFrom<usize>) -> &[$ty] {
let &$thing(ref dat) = self; let &$thing(ref dat) = self;
&dat[index] &dat[index]
} }
} }
impl ::core::ops::Index<::core::ops::RangeFull> for $thing { impl core::ops::Index<core::ops::RangeFull> for $thing {
type Output = [$ty]; type Output = [$ty];
#[inline] #[inline]
fn index(&self, _: ::core::ops::RangeFull) -> &[$ty] { fn index(&self, _: core::ops::RangeFull) -> &[$ty] {
let &$thing(ref dat) = self; let &$thing(ref dat) = self;
&dat[..] &dat[..]
} }
@ -142,7 +142,7 @@ macro_rules! impl_array_newtype {
type Target = $ty; type Target = $ty;
fn as_c_ptr(&self) -> *const Self::Target { fn as_c_ptr(&self) -> *const Self::Target {
if self.is_empty() { if self.is_empty() {
::core::ptr::null() core::ptr::null()
} else { } else {
self.as_ptr() self.as_ptr()
} }
@ -150,7 +150,7 @@ macro_rules! impl_array_newtype {
fn as_mut_c_ptr(&mut self) -> *mut Self::Target { fn as_mut_c_ptr(&mut self) -> *mut Self::Target {
if self.is_empty() { if self.is_empty() {
::core::ptr::null::<Self::Target>() as *mut _ core::ptr::null::<Self::Target>() as *mut _
} else { } else {
self.as_mut_ptr() self.as_mut_ptr()
} }
@ -162,8 +162,8 @@ macro_rules! impl_array_newtype {
#[macro_export] #[macro_export]
macro_rules! impl_raw_debug { macro_rules! impl_raw_debug {
($thing:ident) => { ($thing:ident) => {
impl ::core::fmt::Debug for $thing { impl core::fmt::Debug for $thing {
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
for i in self[..].iter().cloned() { for i in self[..].iter().cloned() {
write!(f, "{:02x}", i)?; write!(f, "{:02x}", i)?;
} }

View File

@ -15,9 +15,9 @@
//! # FFI of the recovery module //! # FFI of the recovery module
use ::types::*; use crate::{Context, Signature, NonceFn, PublicKey, CPtr, impl_array_newtype};
use ::core::fmt; use crate::types::*;
use {Context, Signature, NonceFn, PublicKey, CPtr}; use core::fmt;
/// Library-internal representation of a Secp256k1 signature + recovery ID /// Library-internal representation of a Secp256k1 signature + recovery ID
#[repr(C)] #[repr(C)]
@ -98,13 +98,10 @@ extern "C" {
#[cfg(fuzzing)] #[cfg(fuzzing)]
mod fuzz_dummy { mod fuzz_dummy {
use super::*; use core::slice;
use std::slice;
use secp256k1_ec_pubkey_create; use crate::{secp256k1_ec_pubkey_create, secp256k1_ec_pubkey_parse, secp256k1_ec_pubkey_serialize, SECP256K1_SER_COMPRESSED};
use secp256k1_ec_pubkey_parse; use super::*;
use secp256k1_ec_pubkey_serialize;
use SECP256K1_SER_COMPRESSED;
/// Sets sig to msg32||full pk /// Sets sig to msg32||full pk
pub unsafe fn secp256k1_ecdsa_sign_recoverable( pub unsafe fn secp256k1_ecdsa_sign_recoverable(
@ -170,6 +167,6 @@ mod fuzz_dummy {
1 1
} }
} }
#[cfg(fuzzing)]
pub use self::fuzz_dummy::*;
#[cfg(fuzzing)]
pub use self::fuzz_dummy::*;

View File

@ -54,7 +54,7 @@ mod tests {
use std::any::TypeId; use std::any::TypeId;
use std::mem; use std::mem;
use std::os::raw; use std::os::raw;
use {types, AlignedType}; use crate::{types, AlignedType};
#[test] #[test]
fn verify_types() { fn verify_types() {