From: Devrandom Date: Tue, 3 Aug 2021 07:38:44 +0000 (+0200) Subject: Rename no_std feature to no-std X-Git-Tag: v0.0.100~12^2 X-Git-Url: http://git.bitcoin.ninja/index.cgi?p=rust-lightning;a=commitdiff_plain;h=32d13a2ff8796c2edf2177751eab02242ae10216 Rename no_std feature to no-std matches rust-bitcoin --- diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5b886e19..f18f3f64 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -16,7 +16,7 @@ jobs: 1.41.0, # 1.45.2 is MSRV for lightning-net-tokio, lightning-block-sync, and coverage generation 1.45.2, - # 1.47.0 will be the MSRV for no_std builds using hashbrown once core2 is updated + # 1.47.0 will be the MSRV for no-std builds using hashbrown once core2 is updated 1.47.0] include: - toolchain: stable @@ -87,19 +87,19 @@ jobs: - name: Test on Rust ${{ matrix.toolchain }} with net-tokio and full code-linking for coverage generation if: matrix.coverage run: RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always - - name: Test on no_std bullds Rust ${{ matrix.toolchain }} + - name: Test on no-std bullds Rust ${{ matrix.toolchain }} if: "matrix.build-no-std && !matrix.coverage" run: | cd lightning - cargo test --verbose --color always --no-default-features --features no_std - # check if there is a conflict between no_std and the default std feature - cargo test --verbose --color always --features no_std + cargo test --verbose --color always --no-default-features --features no-std + # check if there is a conflict between no-std and the default std feature + cargo test --verbose --color always --features no-std cd .. - - name: Test on no_std bullds Rust ${{ matrix.toolchain }} and full code-linking for coverage generation + - name: Test on no-std builds Rust ${{ matrix.toolchain }} and full code-linking for coverage generation if: "matrix.build-no-std && matrix.coverage" run: | cd lightning - RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always --no-default-features --features no_std + RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always --no-default-features --features no-std cd .. - name: Test on Rust ${{ matrix.toolchain }} if: "! matrix.build-net-tokio" diff --git a/ci/check-compiles.sh b/ci/check-compiles.sh index 79c2d92b..2bc31007 100755 --- a/ci/check-compiles.sh +++ b/ci/check-compiles.sh @@ -6,4 +6,4 @@ cargo check cargo doc cargo doc --document-private-items cd fuzz && cargo check --features=stdin_fuzz -cd ../lightning && cargo check --no-default-features --features=no_std +cd ../lightning && cargo check --no-default-features --features=no-std diff --git a/lightning/Cargo.toml b/lightning/Cargo.toml index 8bbdfe95..8580a53a 100644 --- a/lightning/Cargo.toml +++ b/lightning/Cargo.toml @@ -26,14 +26,14 @@ max_level_debug = [] unsafe_revoked_tx_signing = [] unstable = [] -no_std = ["hashbrown", "bitcoin/no-std", "core2/alloc"] +no-std = ["hashbrown", "bitcoin/no-std", "core2/alloc"] std = ["bitcoin/std"] default = ["std"] [dependencies] bitcoin = { version = "0.27", default-features = false, features = ["secp-recovery"] } -# TODO maybe bitcoin no-std should pull in this feature? +# TODO remove this once rust-bitcoin PR #637 is released secp256k1 = { version = "0.20.2", default-features = false, features = ["alloc"] } hashbrown = { version = "0.11", optional = true } @@ -45,6 +45,7 @@ core2 = { version = "0.3.0", optional = true, default-features = false } [dev-dependencies] hex = "0.3" regex = "0.1.80" +# TODO remove this once rust-bitcoin PR #637 is released secp256k1 = { version = "0.20.2", default-features = false, features = ["alloc"] } [dev-dependencies.bitcoin] diff --git a/lightning/src/lib.rs b/lightning/src/lib.rs index e1ae9433..e6ecd1f3 100644 --- a/lightning/src/lib.rs +++ b/lightning/src/lib.rs @@ -33,8 +33,8 @@ #![cfg_attr(all(any(test, feature = "_test_utils"), feature = "unstable"), feature(test))] #[cfg(all(any(test, feature = "_test_utils"), feature = "unstable"))] extern crate test; -#[cfg(not(any(feature = "std", feature = "no_std")))] -compile_error!("at least one of the `std` or `no_std` features must be enabled"); +#[cfg(not(any(feature = "std", feature = "no-std")))] +compile_error!("at least one of the `std` or `no-std` features must be enabled"); #[macro_use] extern crate alloc; diff --git a/lightning/src/routing/router.rs b/lightning/src/routing/router.rs index 1d4234d9..13356cc1 100644 --- a/lightning/src/routing/router.rs +++ b/lightning/src/routing/router.rs @@ -3831,7 +3831,7 @@ mod tests { } } - #[cfg(not(feature = "no_std"))] + #[cfg(not(feature = "no-std"))] pub(super) fn random_init_seed() -> u64 { // Because the default HashMap in std pulls OS randomness, we can use it as a (bad) RNG. use core::hash::{BuildHasher, Hasher}; @@ -3839,11 +3839,11 @@ mod tests { println!("Using seed of {}", seed); seed } - #[cfg(not(feature = "no_std"))] + #[cfg(not(feature = "no-std"))] use util::ser::Readable; #[test] - #[cfg(not(feature = "no_std"))] + #[cfg(not(feature = "no-std"))] fn generate_routes() { let mut d = match super::test_utils::get_route_file() { Ok(f) => f, @@ -3871,7 +3871,7 @@ mod tests { } #[test] - #[cfg(not(feature = "no_std"))] + #[cfg(not(feature = "no-std"))] fn generate_routes_mpp() { let mut d = match super::test_utils::get_route_file() { Ok(f) => f, @@ -3899,7 +3899,7 @@ mod tests { } } -#[cfg(all(test, not(feature = "no_std")))] +#[cfg(all(test, not(feature = "no-std")))] pub(crate) mod test_utils { use std::fs::File; /// Tries to open a network graph file, or panics with a URL to fetch it. @@ -3926,7 +3926,7 @@ pub(crate) mod test_utils { } } -#[cfg(all(test, feature = "unstable", not(feature = "no_std")))] +#[cfg(all(test, feature = "unstable", not(feature = "no-std")))] mod benches { use super::*; use util::logger::{Logger, Record};