mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 01:11:10 +00:00
Fix tons of warnings in newest nightly (#2784)
* Fix tons of warnings in newest nightly * Fix sr-api-macro doc tests
This commit is contained in:
@@ -21,7 +21,7 @@ pub struct HexDisplay<'a>(&'a [u8]);
|
||||
|
||||
impl<'a> HexDisplay<'a> {
|
||||
/// Create new instance that will display `d` as a hex string when displayed.
|
||||
pub fn from(d: &'a AsBytesRef) -> Self { HexDisplay(d.as_bytes_ref()) }
|
||||
pub fn from(d: &'a dyn AsBytesRef) -> Self { HexDisplay(d.as_bytes_ref()) }
|
||||
}
|
||||
|
||||
impl<'a> ::core::fmt::Display for HexDisplay<'a> {
|
||||
@@ -79,7 +79,7 @@ pub fn ascii_format(asciish: &[u8]) -> String {
|
||||
let mut latch = false;
|
||||
for c in asciish {
|
||||
match (latch, *c) {
|
||||
(false, 32...127) => r.push(*c as char),
|
||||
(false, 32..=127) => r.push(*c as char),
|
||||
_ => {
|
||||
if !latch {
|
||||
r.push('#');
|
||||
|
||||
@@ -86,7 +86,7 @@ pub enum ExecutionContext {
|
||||
/// Context used for block construction.
|
||||
BlockConstruction,
|
||||
/// Offchain worker context.
|
||||
OffchainWorker(Box<offchain::Externalities>),
|
||||
OffchainWorker(Box<dyn offchain::Externalities>),
|
||||
/// Context used for other calls.
|
||||
Other,
|
||||
}
|
||||
|
||||
@@ -35,8 +35,8 @@ impl TryFrom<u32> for CryptoKind {
|
||||
|
||||
fn try_from(kind: u32) -> Result<Self, Self::Error> {
|
||||
match kind {
|
||||
e if e == CryptoKind::Sr25519 as u8 as u32 => Ok(CryptoKind::Sr25519),
|
||||
e if e == CryptoKind::Ed25519 as u8 as u32 => Ok(CryptoKind::Ed25519),
|
||||
e if e == u32::from(CryptoKind::Sr25519 as u8) => Ok(CryptoKind::Sr25519),
|
||||
e if e == u32::from(CryptoKind::Ed25519 as u8) => Ok(CryptoKind::Ed25519),
|
||||
_ => Err(())
|
||||
}
|
||||
}
|
||||
@@ -103,7 +103,7 @@ impl From<HttpRequestStatus> for u32 {
|
||||
HttpRequestStatus::Unknown => 0,
|
||||
HttpRequestStatus::DeadlineReached => 10,
|
||||
HttpRequestStatus::Timeout => 20,
|
||||
HttpRequestStatus::Finished(code) => code as u32,
|
||||
HttpRequestStatus::Finished(code) => u32::from(code),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -116,7 +116,7 @@ impl TryFrom<u32> for HttpRequestStatus {
|
||||
0 => Ok(HttpRequestStatus::Unknown),
|
||||
10 => Ok(HttpRequestStatus::DeadlineReached),
|
||||
20 => Ok(HttpRequestStatus::Timeout),
|
||||
100...999 => Ok(HttpRequestStatus::Finished(status as u16)),
|
||||
100..=999 => u16::try_from(status).map(HttpRequestStatus::Finished).map_err(|_| ()),
|
||||
_ => Err(()),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -204,16 +204,16 @@ impl From<schnorrkel::Signature> for Signature {
|
||||
}
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
impl ::std::fmt::Debug for Signature {
|
||||
impl std::fmt::Debug for Signature {
|
||||
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
|
||||
write!(f, "{}", crate::hexdisplay::HexDisplay::from(&self.0))
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
impl ::std::hash::Hash for Signature {
|
||||
fn hash<H: ::std::hash::Hasher>(&self, state: &mut H) {
|
||||
::std::hash::Hash::hash(&self.0[..], state);
|
||||
impl std::hash::Hash for Signature {
|
||||
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
|
||||
std::hash::Hash::hash(&self.0[..], state);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -304,15 +304,13 @@ impl Public {
|
||||
|
||||
/// Return a `Vec<u8>` filled with raw data.
|
||||
#[cfg(feature = "std")]
|
||||
pub fn to_raw_vec(self) -> Vec<u8> {
|
||||
let r: &[u8; 32] = self.as_ref();
|
||||
r.to_vec()
|
||||
pub fn into_raw_vec(self) -> Vec<u8> {
|
||||
self.0.to_vec()
|
||||
}
|
||||
|
||||
/// Return a slice filled with raw data.
|
||||
pub fn as_slice(&self) -> &[u8] {
|
||||
let r: &[u8; 32] = self.as_ref();
|
||||
&r[..]
|
||||
&self.0
|
||||
}
|
||||
|
||||
/// Return a slice filled with raw data.
|
||||
@@ -637,7 +635,7 @@ mod test {
|
||||
#[test]
|
||||
fn verify_from_wasm_works() {
|
||||
// The values in this test case are compared to the output of `node-test.js` in schnorrkel-js.
|
||||
//
|
||||
//
|
||||
// This is to make sure that the wasm library is compatible.
|
||||
let pk = Pair::from_seed(hex!("0000000000000000000000000000000000000000000000000000000000000000"));
|
||||
let public = pk.public();
|
||||
|
||||
Reference in New Issue
Block a user