Skip to content

Commit 26a52bc

Browse files
committed
Update secp256k1-sys to edition 2018 and fix imports
1 parent ebe46a4 commit 26a52bc

File tree

5 files changed

+26
-32
lines changed

5 files changed

+26
-32
lines changed

secp256k1-sys/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ keywords = [ "secp256k1", "libsecp256k1", "ffi" ]
1313
readme = "README.md"
1414
build = "build.rs"
1515
links = "rustsecp256k1_v0_5_0"
16+
edition = "2018"
1617

1718
# Should make docs.rs show all functions, even those behind non-default features
1819
[package.metadata.docs.rs]

secp256k1-sys/src/lib.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,7 @@
1717
//! not be needed for most users.
1818
1919
// Coding conventions
20-
#![deny(non_upper_case_globals)]
21-
#![deny(non_camel_case_types)]
22-
#![deny(non_snake_case)]
23-
#![deny(unused_mut)]
20+
#![deny(non_upper_case_globals, non_camel_case_types, non_snake_case, unused_mut)]
2421

2522
#![cfg_attr(all(not(test), not(feature = "std")), no_std)]
2623
#![cfg_attr(docsrs, feature(doc_cfg))]
@@ -31,7 +28,6 @@ extern crate core;
3128
#[cfg(fuzzing)]
3229
const THIS_UNUSED_CONSTANT_IS_YOUR_WARNING_THAT_ALL_THE_CRYPTO_IN_THIS_LIB_IS_DISABLED_FOR_FUZZING: usize = 0;
3330

34-
#[macro_use]
3531
mod macros;
3632
pub mod types;
3733

secp256k1-sys/src/macros.rs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -69,14 +69,14 @@ macro_rules! impl_array_newtype {
6969

7070
impl PartialOrd for $thing {
7171
#[inline]
72-
fn partial_cmp(&self, other: &$thing) -> Option<::core::cmp::Ordering> {
72+
fn partial_cmp(&self, other: &$thing) -> Option<core::cmp::Ordering> {
7373
self[..].partial_cmp(&other[..])
7474
}
7575
}
7676

7777
impl Ord for $thing {
7878
#[inline]
79-
fn cmp(&self, other: &$thing) -> ::core::cmp::Ordering {
79+
fn cmp(&self, other: &$thing) -> core::cmp::Ordering {
8080
self[..].cmp(&other[..])
8181
}
8282
}
@@ -89,7 +89,7 @@ macro_rules! impl_array_newtype {
8989
}
9090
}
9191

92-
impl ::core::ops::Index<usize> for $thing {
92+
impl core::ops::Index<usize> for $thing {
9393
type Output = $ty;
9494

9595
#[inline]
@@ -99,41 +99,41 @@ macro_rules! impl_array_newtype {
9999
}
100100
}
101101

102-
impl ::core::ops::Index<::core::ops::Range<usize>> for $thing {
102+
impl core::ops::Index<core::ops::Range<usize>> for $thing {
103103
type Output = [$ty];
104104

105105
#[inline]
106-
fn index(&self, index: ::core::ops::Range<usize>) -> &[$ty] {
106+
fn index(&self, index: core::ops::Range<usize>) -> &[$ty] {
107107
let &$thing(ref dat) = self;
108108
&dat[index]
109109
}
110110
}
111111

112-
impl ::core::ops::Index<::core::ops::RangeTo<usize>> for $thing {
112+
impl core::ops::Index<core::ops::RangeTo<usize>> for $thing {
113113
type Output = [$ty];
114114

115115
#[inline]
116-
fn index(&self, index: ::core::ops::RangeTo<usize>) -> &[$ty] {
116+
fn index(&self, index: core::ops::RangeTo<usize>) -> &[$ty] {
117117
let &$thing(ref dat) = self;
118118
&dat[index]
119119
}
120120
}
121121

122-
impl ::core::ops::Index<::core::ops::RangeFrom<usize>> for $thing {
122+
impl core::ops::Index<core::ops::RangeFrom<usize>> for $thing {
123123
type Output = [$ty];
124124

125125
#[inline]
126-
fn index(&self, index: ::core::ops::RangeFrom<usize>) -> &[$ty] {
126+
fn index(&self, index: core::ops::RangeFrom<usize>) -> &[$ty] {
127127
let &$thing(ref dat) = self;
128128
&dat[index]
129129
}
130130
}
131131

132-
impl ::core::ops::Index<::core::ops::RangeFull> for $thing {
132+
impl core::ops::Index<core::ops::RangeFull> for $thing {
133133
type Output = [$ty];
134134

135135
#[inline]
136-
fn index(&self, _: ::core::ops::RangeFull) -> &[$ty] {
136+
fn index(&self, _: core::ops::RangeFull) -> &[$ty] {
137137
let &$thing(ref dat) = self;
138138
&dat[..]
139139
}
@@ -142,15 +142,15 @@ macro_rules! impl_array_newtype {
142142
type Target = $ty;
143143
fn as_c_ptr(&self) -> *const Self::Target {
144144
if self.is_empty() {
145-
::core::ptr::null()
145+
core::ptr::null()
146146
} else {
147147
self.as_ptr()
148148
}
149149
}
150150

151151
fn as_mut_c_ptr(&mut self) -> *mut Self::Target {
152152
if self.is_empty() {
153-
::core::ptr::null::<Self::Target>() as *mut _
153+
core::ptr::null::<Self::Target>() as *mut _
154154
} else {
155155
self.as_mut_ptr()
156156
}
@@ -162,8 +162,8 @@ macro_rules! impl_array_newtype {
162162
#[macro_export]
163163
macro_rules! impl_raw_debug {
164164
($thing:ident) => {
165-
impl ::core::fmt::Debug for $thing {
166-
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
165+
impl core::fmt::Debug for $thing {
166+
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
167167
for i in self[..].iter().cloned() {
168168
write!(f, "{:02x}", i)?;
169169
}

secp256k1-sys/src/recovery.rs

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515

1616
//! # FFI of the recovery module
1717
18-
use ::types::*;
19-
use ::core::fmt;
20-
use {Context, Signature, NonceFn, PublicKey, CPtr};
18+
use crate::{Context, Signature, NonceFn, PublicKey, CPtr, impl_array_newtype};
19+
use crate::types::*;
20+
use core::fmt;
2121

2222
/// Library-internal representation of a Secp256k1 signature + recovery ID
2323
#[repr(C)]
@@ -98,13 +98,10 @@ extern "C" {
9898

9999
#[cfg(fuzzing)]
100100
mod fuzz_dummy {
101-
use super::*;
102-
use std::slice;
101+
use core::slice;
103102

104-
use secp256k1_ec_pubkey_create;
105-
use secp256k1_ec_pubkey_parse;
106-
use secp256k1_ec_pubkey_serialize;
107-
use SECP256K1_SER_COMPRESSED;
103+
use crate::{secp256k1_ec_pubkey_create, secp256k1_ec_pubkey_parse, secp256k1_ec_pubkey_serialize, SECP256K1_SER_COMPRESSED};
104+
use super::*;
108105

109106
/// Sets sig to msg32||full pk
110107
pub unsafe fn secp256k1_ecdsa_sign_recoverable(
@@ -170,6 +167,6 @@ mod fuzz_dummy {
170167
1
171168
}
172169
}
173-
#[cfg(fuzzing)]
174-
pub use self::fuzz_dummy::*;
175170

171+
#[cfg(fuzzing)]
172+
pub use self::fuzz_dummy::*;

secp256k1-sys/src/types.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ mod tests {
5454
use std::any::TypeId;
5555
use std::mem;
5656
use std::os::raw;
57-
use {types, AlignedType};
57+
use crate::{types, AlignedType};
5858

5959
#[test]
6060
fn verify_types() {

0 commit comments

Comments
 (0)