Rename no_std feature to no-std

matches rust-bitcoin
This commit is contained in:
Devrandom 2021-08-03 09:38:44 +02:00
parent 0dfcacd22c
commit 32d13a2ff8
5 changed files with 19 additions and 18 deletions

View file

@ -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"

View file

@ -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

View file

@ -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]

View file

@ -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;

View file

@ -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};