Skip to content

Commit 1a818ea

Browse files
authored
Merge pull request #260 from tcharding/clippy
Clear clippy warnings
2 parents 3151352 + 02dec3e commit 1a818ea

File tree

3 files changed

+18
-11
lines changed

3 files changed

+18
-11
lines changed

secp256k1-sys/src/lib.rs

+8-4
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ pub const SECP256K1_START_VERIFY: c_uint = 1 | (1 << 8);
4343
/// Flag for context to enable signing precomputation
4444
pub const SECP256K1_START_SIGN: c_uint = 1 | (1 << 9);
4545
/// Flag for keys to indicate uncompressed serialization format
46+
#[allow(unused_parens)]
4647
pub const SECP256K1_SER_UNCOMPRESSED: c_uint = (1 << 1);
4748
/// Flag for keys to indicate compressed serialization format
4849
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:
629630
panic!("[libsecp256k1] internal consistency check failed {}", msg);
630631
}
631632

632-
633+
#[no_mangle]
634+
#[cfg(not(feature = "external-symbols"))]
633635
unsafe fn strlen(mut str_ptr: *const c_char) -> usize {
634636
let mut ctr = 0;
635637
while *str_ptr != '\0' as c_char {
@@ -1160,11 +1162,13 @@ pub use self::fuzz_dummy::*;
11601162

11611163
#[cfg(test)]
11621164
mod tests {
1163-
use std::ffi::CString;
1164-
use super::strlen;
1165-
1165+
#[no_mangle]
1166+
#[cfg(not(feature = "external-symbols"))]
11661167
#[test]
11671168
fn test_strlen() {
1169+
use std::ffi::CString;
1170+
use super::strlen;
1171+
11681172
let orig = "test strlen \t \n";
11691173
let test = CString::new(orig).unwrap();
11701174

secp256k1-sys/src/macros.rs

+9-7
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,6 @@ macro_rules! impl_array_newtype {
3434
dat.as_mut_ptr()
3535
}
3636

37-
#[inline]
38-
/// Gets a reference to the underlying array
39-
pub fn as_ref(&self) -> &[$ty; $len] {
40-
let &$thing(ref dat) = self;
41-
dat
42-
}
43-
4437
#[inline]
4538
/// Returns the length of the object as an array
4639
pub fn len(&self) -> usize { $len }
@@ -50,6 +43,15 @@ macro_rules! impl_array_newtype {
5043
pub fn is_empty(&self) -> bool { false }
5144
}
5245

46+
impl AsRef<[$ty; $len]> for $thing {
47+
#[inline]
48+
/// Gets a reference to the underlying array
49+
fn as_ref(&self) -> &[$ty; $len] {
50+
let &$thing(ref dat) = self;
51+
dat
52+
}
53+
}
54+
5355
impl PartialEq for $thing {
5456
#[inline]
5557
fn eq(&self, other: &$thing) -> bool {

secp256k1-sys/src/types.rs

+1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ impl AlignedType {
4040
}
4141
}
4242

43+
#[cfg(all(feature = "std", not(feature = "external-symbols")))]
4344
pub(crate) const ALIGN_TO: usize = mem::align_of::<AlignedType>();
4445

4546

0 commit comments

Comments
 (0)