From 3426723dda396f479d363fea068d66a2d179b6f0 Mon Sep 17 00:00:00 2001 From: "Tobin C. Harding" Date: Thu, 19 Dec 2024 12:50:26 +1100 Subject: [PATCH] Format the node crate `node` is excluded from the workspace so it currently does not get formatted by `just fmt`. Modify the `justfile` so that the `node` directory gets formatted. Includes a trivial error message change to make the line shorter. --- justfile | 5 +++++ node/src/lib.rs | 9 +++++---- node/src/versions.rs | 20 ++++++++++++++++++-- 3 files changed, 28 insertions(+), 6 deletions(-) diff --git a/justfile b/justfile index f5fd526..01388f6 100644 --- a/justfile +++ b/justfile @@ -1,3 +1,7 @@ +set export + +REPO_DIR := `git rev-parse --show-toplevel` + default: @just --list @@ -16,6 +20,7 @@ lint: # Run cargo fmt fmt: cargo +$(cat ./nightly-version) fmt --all + cd $REPO_DIR/node > /dev/null; cargo +$(cat ../nightly-version) fmt # Check the formatting format: diff --git a/node/src/lib.rs b/node/src/lib.rs index 8197bc3..b09155e 100644 --- a/node/src/lib.rs +++ b/node/src/lib.rs @@ -401,9 +401,9 @@ impl Node { match client_base.create_wallet(wallet) { Ok(json) => { debug!("created wallet: {}", json.name()); - }, + } Err(e) => { - debug!("initial create_wallet unsuccessful, try loading instead: {:?}", e); + debug!("initial create_wallet failed, try load instead: {:?}", e); let wallet = client_base.load_wallet(wallet)?.name(); debug!("loaded wallet: {}", wallet); } @@ -577,9 +577,9 @@ mod test { use tempfile::TempDir; use super::*; - use crate::{exe_path, get_available_port, Node, Conf, LOCAL_IP}; #[cfg(not(feature = "28_0"))] use crate::P2P; + use crate::{exe_path, get_available_port, Conf, Node, LOCAL_IP}; #[test] fn test_local_ip() { @@ -706,7 +706,8 @@ mod test { let node2 = Node::with_conf(&exe, &conf_node2).unwrap(); // Create Node 3 Connected To Node - let conf_node3 = Conf::<'_> { p2p: node2.p2p_connect(false).unwrap(), ..Default::default() }; + let conf_node3 = + Conf::<'_> { p2p: node2.p2p_connect(false).unwrap(), ..Default::default() }; let node3 = Node::with_conf(exe_path().unwrap(), &conf_node3).unwrap(); // Get each nodes Peers diff --git a/node/src/versions.rs b/node/src/versions.rs index d217ce0..3af085d 100644 --- a/node/src/versions.rs +++ b/node/src/versions.rs @@ -47,6 +47,22 @@ pub const VERSION: &str = "0.18.1"; pub const VERSION: &str = "0.17.1"; // To make --no-default-features work we have to enable some feature, use most recent version same as for default. -#[cfg(all(not(feature = "28_0"), not(feature = "27_1"), not(feature = "27_0"), not(feature = "26_2"), not(feature = "26_1"), not(feature = "26_0"), not(feature = "25_2"), not(feature = "24_2"), not(feature = "23_2"), not(feature = "22_1"), not(feature = "0_21_2"), not(feature = "0_20_2"), not(feature = "0_19_1"), not(feature = "0_18_1"), not(feature = "0_17_1")))] -#[allow(dead_code)] // for --no-default-features +#[cfg(all( + not(feature = "28_0"), + not(feature = "27_1"), + not(feature = "27_0"), + not(feature = "26_2"), + not(feature = "26_1"), + not(feature = "26_0"), + not(feature = "25_2"), + not(feature = "24_2"), + not(feature = "23_2"), + not(feature = "22_1"), + not(feature = "0_21_2"), + not(feature = "0_20_2"), + not(feature = "0_19_1"), + not(feature = "0_18_1"), + not(feature = "0_17_1") +))] +#[allow(dead_code)] // for --no-default-features pub const VERSION: &str = "28.0";