From 3912699c751b88f7eb1138603be8d4a8aba38c12 Mon Sep 17 00:00:00 2001 From: "Dr. Maxim Orlovsky" Date: Sun, 20 Nov 2022 18:19:55 +0100 Subject: [PATCH] Fix lints, CI etc --- .github/workflows/build.yml | 20 +------------------- Cargo.toml | 1 - README.md | 2 +- identity/src/lib.rs | 11 ++++++----- 4 files changed, 8 insertions(+), 26 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b3e00d8b..b32c3839 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -68,7 +68,7 @@ jobs: strategy: fail-fast: false matrix: - toolchain: [ nightly, beta, stable ] + toolchain: [ nightly, beta, stable, 1.59.0 ] steps: - uses: actions/checkout@v2 - name: Install rust ${{ matrix.toolchain }} @@ -81,24 +81,6 @@ jobs: with: command: check args: --workspace --all-targets --all-features - toolchains-old: - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - toolchain: [ 1.51.0 ] - steps: - - uses: actions/checkout@v2 - - name: Install rust ${{ matrix.toolchain }} - uses: actions-rs/toolchain@v1 - with: - toolchain: ${{ matrix.toolchain }} - override: true - - name: All features - uses: actions-rs/cargo@v1 - with: - command: check - args: --workspace --all-targets --features all_msrv47 dependency: runs-on: ubuntu-latest steps: diff --git a/Cargo.toml b/Cargo.toml index c910d250..dd85bb9a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -48,7 +48,6 @@ serde = ["serde_crate", "serde_with", "amplify/serde", identity = ["lnpbp_identity"] elgamal = ["lnpbp_elgamal"] # Provides ElGamal encryption module from this library zip = ["lnpbp_bech32/zip"] -all_msrv47 = ["serde", "elgamal", "zip"] # Used in testing against MSRV 1.47 [workspace] members = [".", "bech32", "chain", "elgamal", "identity"] diff --git a/README.md b/README.md index a440d502..7c81a0d5 100644 --- a/README.md +++ b/README.md @@ -60,7 +60,7 @@ The development of the libraries is supported by LNP/BP Standards Association. ### Clone and compile library -Minimum supported rust compiler version (MSRV): 1.51.0 (if command-line tool is not used) and 1.54.0 (otherwise). +Minimum supported rust compiler version (MSRV): 1.59.0. ```shell script git clone https://github.com/lnp-bp/rust-lnpbp diff --git a/identity/src/lib.rs b/identity/src/lib.rs index 98d77ef0..76507be6 100644 --- a/identity/src/lib.rs +++ b/identity/src/lib.rs @@ -79,6 +79,7 @@ pub enum HashAlgo { } impl HashAlgo { + #[allow(clippy::len_without_is_empty)] pub fn len(self) -> u8 { match self { Self::Sha256d => 32, @@ -197,7 +198,7 @@ impl StrictDecode for IdentitySigner { impl IdentitySigner { pub fn new_bip340() -> Self { - let pair = secp256k1::KeyPair::new(&SECP256K1, &mut rand::thread_rng()); + let pair = secp256k1::KeyPair::new(SECP256K1, &mut rand::thread_rng()); let cert = IdentityCert::from(pair); Self { cert, @@ -210,7 +211,7 @@ impl IdentitySigner { EcAlgo::Bip340 => { let sk = secp256k1::SecretKey::from_slice(&self.prvkey) .expect("invalid private key"); - let pair = secp256k1::KeyPair::from_secret_key(&SECP256K1, &sk); + let pair = secp256k1::KeyPair::from_secret_key(SECP256K1, &sk); let msg = Message::from_hashed_data::(msg.as_ref()); let sig = pair.sign_schnorr(msg); @@ -229,7 +230,7 @@ impl IdentitySigner { EcAlgo::Bip340 => { let sk = secp256k1::SecretKey::from_slice(&self.prvkey) .expect("invalid private key"); - let pair = secp256k1::KeyPair::from_secret_key(&SECP256K1, &sk); + let pair = secp256k1::KeyPair::from_secret_key(SECP256K1, &sk); let mut engine = sha256d::Hash::engine(); let mut buf = [0u8; 64]; loop { @@ -582,7 +583,7 @@ sig a711 0f0e 0068 2f01 aa74 c96b 97b3 84e3 3b19 283f 101f 9a67 dd02 e9ac 2ba1 } #[test] - #[should_panic(expected = "InvalidSig)")] + #[should_panic(expected = "InvalidSig")] fn wrong_sig_msg() { let me = IdentitySigner::new_bip340(); let msg = "This is me"; @@ -591,7 +592,7 @@ sig a711 0f0e 0068 2f01 aa74 c96b 97b3 84e3 3b19 283f 101f 9a67 dd02 e9ac 2ba1 } #[test] - #[should_panic(expected = "InvalidSig)")] + #[should_panic(expected = "InvalidSig")] fn wrong_sig_key() { let me = IdentitySigner::new_bip340(); let other = IdentitySigner::new_bip340();