diff --git a/members/libpt-bin/src/ccc/mod.rs b/members/libpt-bin/src/ccc/mod.rs index 4206d66..c00f35a 100644 --- a/members/libpt-bin/src/ccc/mod.rs +++ b/members/libpt-bin/src/ccc/mod.rs @@ -19,7 +19,7 @@ use libpt::ccc::*; use libpt::log::*; use clap::Parser; -use clap_verbosity_flag::{Verbosity, InfoLevel}; +use clap_verbosity_flag::{InfoLevel, Verbosity}; use std::path::PathBuf; @@ -64,7 +64,7 @@ pub struct Cli { pub log_meta: bool, /// your exporession(s) - #[clap(trailing_var_arg=true)] + #[clap(trailing_var_arg = true)] pub expression: Vec, } @@ -126,16 +126,5 @@ fn main() { for part in cli.expression { expr += ∂ } - - debug!("exporssion: {}", expr); - let r = Calculator::oneshot(expr); - match r { - Ok(r) => { - println!("{r}"); - } - Err(err) => { - error!("Could not compute: {err}"); - } - } } //////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/members/libpt-bin/src/main/args.rs b/members/libpt-bin/src/main/args.rs index 16125c7..43d2266 100644 --- a/members/libpt-bin/src/main/args.rs +++ b/members/libpt-bin/src/main/args.rs @@ -19,7 +19,7 @@ use clap::{Parser, Subcommand}; use clap_num::number_range; -use clap_verbosity_flag::{Verbosity, InfoLevel}; +use clap_verbosity_flag::{InfoLevel, Verbosity}; //// CONSTANTS ///////////////////////////////////////////////////////////////////////////////////// /// short about section displayed in help @@ -103,13 +103,10 @@ pub enum NetCommands { /// set a timeout (in ms) #[clap(short, long, default_value_t = 100)] - timeout: u64 - + timeout: u64, }, /// discover hosts in your network - Discover { - - } + Discover {}, } //////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/members/libpt-bin/src/main/mod.rs b/members/libpt-bin/src/main/mod.rs index 86af0da..60618ad 100644 --- a/members/libpt-bin/src/main/mod.rs +++ b/members/libpt-bin/src/main/mod.rs @@ -13,7 +13,6 @@ // enable clippy's extra lints, the pedantic version #![warn(clippy::pedantic)] - //// IMPORTS /////////////////////////////////////////////////////////////////////////////////////// use libpt::{log::*, net::monitoring::uptime}; @@ -26,7 +25,6 @@ use std::path::PathBuf; //// CONSTANTS ///////////////////////////////////////////////////////////////////////////////////// #[allow(dead_code)] - //// STATICS /////////////////////////////////////////////////////////////////////////////////////// //// MACROS //////////////////////////////////////////////////////////////////////////////////////// diff --git a/members/libpt-bintols/src/datalayout.rs b/members/libpt-bintols/src/datalayout.rs index 2cdeabc..d9a04f9 100644 --- a/members/libpt-bintols/src/datalayout.rs +++ b/members/libpt-bintols/src/datalayout.rs @@ -20,7 +20,8 @@ macro_rules! investigate_memory_layout { let pointer = item as *const $t; let mut memory: [u8; std::mem::size_of::<$t>()] = std::mem::transmute(item.clone()); memory.reverse(); - println!("\ + println!( + "\ \t{index:02x}\titem:\t\t{item:?}\n\ \t\tpointer: \t{:X?}\n\ \t\talign: \t{}\n\ diff --git a/members/libpt-bintols/src/display.rs b/members/libpt-bintols/src/display.rs index e0fffc1..949cbee 100644 --- a/members/libpt-bintols/src/display.rs +++ b/members/libpt-bintols/src/display.rs @@ -59,8 +59,7 @@ where return format!("{:.2} Z", total.to_f64().unwrap() / ZEBI as f64); } else if YOBI <= total { return format!("{:.2} Y", total.to_f64().unwrap() / YOBI as f64); - } - else { + } else { unreachable!() } } diff --git a/members/libpt-bintols/tests/display.rs b/members/libpt-bintols/tests/display.rs index 20e232c..c730a1c 100644 --- a/members/libpt-bintols/tests/display.rs +++ b/members/libpt-bintols/tests/display.rs @@ -1,5 +1,5 @@ -use libpt_bintols::*; use libpt_bintols::display::*; +use libpt_bintols::*; #[test] fn btobin() { @@ -10,11 +10,16 @@ fn btobin() { #[test] fn big_btobin() { - let data = [12,31,82,32,123,32,92,23,12,32,12,1,1,1]; + let data = [12, 31, 82, 32, 123, 32, 92, 23, 12, 32, 12, 1, 1, 1]; let r = bytes_to_bin(&data); - assert_eq!(r, format!("0b00001100_00011111_01010010_\ + assert_eq!( + r, + format!( + "0b00001100_00011111_01010010_\ 00100000_01111011_00100000_01011100_00010111_00001100\n\ - _00100000_00001100_00000001_00000001_00000001")); + _00100000_00001100_00000001_00000001_00000001" + ) + ); } #[test] @@ -26,38 +31,38 @@ fn bybit() { #[test] fn hmnbytes() { - assert_eq!(humanbytes(0), format!("0 B")); - assert_eq!(humanbytes(1), format!("1 B")); + assert_eq!(humanbytes(0), format!("0 B")); + assert_eq!(humanbytes(1), format!("1 B")); - assert_eq!(humanbytes(KIBI-1), format!("1023 B")); - assert_eq!(humanbytes(KIBI), format!("1.00 K")); - assert_eq!(humanbytes(KIBI+1), format!("1.00 K")); + assert_eq!(humanbytes(KIBI - 1), format!("1023 B")); + assert_eq!(humanbytes(KIBI), format!("1.00 K")); + assert_eq!(humanbytes(KIBI + 1), format!("1.00 K")); - assert_eq!(humanbytes(MEBI-1), format!("1024.00 K")); - assert_eq!(humanbytes(MEBI), format!("1.00 M")); - assert_eq!(humanbytes(MEBI+1), format!("1.00 M")); + assert_eq!(humanbytes(MEBI - 1), format!("1024.00 K")); + assert_eq!(humanbytes(MEBI), format!("1.00 M")); + assert_eq!(humanbytes(MEBI + 1), format!("1.00 M")); - assert_eq!(humanbytes(GIBI-1), format!("1024.00 M")); - assert_eq!(humanbytes(GIBI), format!("1.00 G")); - assert_eq!(humanbytes(GIBI+1), format!("1.00 G")); + assert_eq!(humanbytes(GIBI - 1), format!("1024.00 M")); + assert_eq!(humanbytes(GIBI), format!("1.00 G")); + assert_eq!(humanbytes(GIBI + 1), format!("1.00 G")); - assert_eq!(humanbytes(TEBI-1), format!("1024.00 G")); - assert_eq!(humanbytes(TEBI), format!("1.00 T")); - assert_eq!(humanbytes(TEBI+1), format!("1.00 T")); + assert_eq!(humanbytes(TEBI - 1), format!("1024.00 G")); + assert_eq!(humanbytes(TEBI), format!("1.00 T")); + assert_eq!(humanbytes(TEBI + 1), format!("1.00 T")); - assert_eq!(humanbytes(PEBI-1), format!("1024.00 T")); - assert_eq!(humanbytes(PEBI), format!("1.00 P")); - assert_eq!(humanbytes(PEBI+1), format!("1.00 P")); + assert_eq!(humanbytes(PEBI - 1), format!("1024.00 T")); + assert_eq!(humanbytes(PEBI), format!("1.00 P")); + assert_eq!(humanbytes(PEBI + 1), format!("1.00 P")); - assert_eq!(humanbytes(EXBI-1), format!("1024.00 P")); - assert_eq!(humanbytes(EXBI), format!("1.00 E")); - assert_eq!(humanbytes(EXBI+1), format!("1.00 E")); + assert_eq!(humanbytes(EXBI - 1), format!("1024.00 P")); + assert_eq!(humanbytes(EXBI), format!("1.00 E")); + assert_eq!(humanbytes(EXBI + 1), format!("1.00 E")); - assert_eq!(humanbytes(ZEBI-1), format!("1024.00 E")); - assert_eq!(humanbytes(ZEBI), format!("1.00 Z")); - assert_eq!(humanbytes(ZEBI+1), format!("1.00 Z")); + assert_eq!(humanbytes(ZEBI - 1), format!("1024.00 E")); + assert_eq!(humanbytes(ZEBI), format!("1.00 Z")); + assert_eq!(humanbytes(ZEBI + 1), format!("1.00 Z")); - assert_eq!(humanbytes(YOBI-1), format!("1024.00 Z")); - assert_eq!(humanbytes(YOBI), format!("1.00 Y")); - assert_eq!(humanbytes(YOBI+1), format!("1.00 Y")); + assert_eq!(humanbytes(YOBI - 1), format!("1024.00 Z")); + assert_eq!(humanbytes(YOBI), format!("1.00 Y")); + assert_eq!(humanbytes(YOBI + 1), format!("1.00 Y")); } diff --git a/members/libpt-core/src/lib.rs b/members/libpt-core/src/lib.rs index 6845ebb..4844585 100644 --- a/members/libpt-core/src/lib.rs +++ b/members/libpt-core/src/lib.rs @@ -10,11 +10,9 @@ // we want docs #![warn(missing_docs)] #![warn(rustdoc::missing_crate_level_docs)] - //////////////////////////////////////////////////////////////////////////////////////////////////// // we want Debug everywhere. #![warn(missing_debug_implementations)] - //////////////////////////////////////////////////////////////////////////////////////////////////// // enable clippy's extra lints, the pedantic version #![warn(clippy::pedantic)] diff --git a/members/libpt-core/src/macros.rs b/members/libpt-core/src/macros.rs index 57b5b2c..cb9385b 100644 --- a/members/libpt-core/src/macros.rs +++ b/members/libpt-core/src/macros.rs @@ -6,11 +6,9 @@ // we want docs #![warn(missing_docs)] #![warn(rustdoc::missing_crate_level_docs)] - //////////////////////////////////////////////////////////////////////////////////////////////////// // we want Debug everywhere. #![warn(missing_debug_implementations)] - //////////////////////////////////////////////////////////////////////////////////////////////////// // enable clippy's extra lints, the pedantic version #![warn(clippy::pedantic)] diff --git a/members/libpt-log/src/error.rs b/members/libpt-log/src/error.rs index 94db124..3931cf8 100644 --- a/members/libpt-log/src/error.rs +++ b/members/libpt-log/src/error.rs @@ -90,4 +90,3 @@ impl std::fmt::Display for Error { //// PUBLIC FUNCTIONS ////////////////////////////////////////////////////////////////////////////// //// PRIVATE FUNCTIONS ///////////////////////////////////////////////////////////////////////////// - diff --git a/members/libpt-log/src/lib.rs b/members/libpt-log/src/lib.rs index ee73ee7..feca316 100644 --- a/members/libpt-log/src/lib.rs +++ b/members/libpt-log/src/lib.rs @@ -28,7 +28,7 @@ use error::*; pub use tracing::{debug, error, info, trace, warn, Level}; use tracing_appender; -use tracing_subscriber::{prelude::*, fmt::format::FmtSpan}; +use tracing_subscriber::{fmt::format::FmtSpan, prelude::*}; use pyo3::prelude::*; //// CONSTANTS ///////////////////////////////////////////////////////////////////////////////////// @@ -254,4 +254,3 @@ impl fmt::Debug for Logger { //// PUBLIC FUNCTIONS ////////////////////////////////////////////////////////////////////////////// //// PRIVATE FUNCTIONS ///////////////////////////////////////////////////////////////////////////// - diff --git a/members/libpt-net/src/lib.rs b/members/libpt-net/src/lib.rs index ed70302..f00c877 100644 --- a/members/libpt-net/src/lib.rs +++ b/members/libpt-net/src/lib.rs @@ -10,11 +10,9 @@ // we want docs #![warn(missing_docs)] #![warn(rustdoc::missing_crate_level_docs)] - //////////////////////////////////////////////////////////////////////////////////////////////////// // we want Debug everywhere. #![warn(missing_debug_implementations)] - //////////////////////////////////////////////////////////////////////////////////////////////////// // enable clippy's extra lints, the pedantic version #![warn(clippy::pedantic)] diff --git a/members/libpt-net/src/monitoring/mod.rs b/members/libpt-net/src/monitoring/mod.rs index 22d84ed..306c78f 100644 --- a/members/libpt-net/src/monitoring/mod.rs +++ b/members/libpt-net/src/monitoring/mod.rs @@ -6,11 +6,9 @@ // we want docs #![warn(missing_docs)] #![warn(rustdoc::missing_crate_level_docs)] - //////////////////////////////////////////////////////////////////////////////////////////////////// // we want Debug everywhere. #![warn(missing_debug_implementations)] - //////////////////////////////////////////////////////////////////////////////////////////////////// // enable clippy's extra lints, the pedantic version #![warn(clippy::pedantic)] diff --git a/members/libpt-net/src/monitoring/uptime.rs b/members/libpt-net/src/monitoring/uptime.rs index 8d3a9c4..21b55f8 100644 --- a/members/libpt-net/src/monitoring/uptime.rs +++ b/members/libpt-net/src/monitoring/uptime.rs @@ -188,7 +188,11 @@ pub fn continuous_uptime_monitor( let mut last_was_up: bool = true; let mut last_ratio: u8 = status.success_ratio; loop { - trace!(?status, ?last_was_up, "loop iteration for continuous uptime monitor"); + trace!( + ?status, + ?last_was_up, + "loop iteration for continuous uptime monitor" + ); if !status.success { if last_was_up { trace!("displaying status"); diff --git a/members/libpt-py/src/lib.rs b/members/libpt-py/src/lib.rs index ab60524..7adc679 100644 --- a/members/libpt-py/src/lib.rs +++ b/members/libpt-py/src/lib.rs @@ -1,7 +1,5 @@ // FIXME: Using a local dependency does not work with maturin as it seems? -use libpt::{ - log::*, -}; +use libpt::log::*; use pyo3::prelude::*; diff --git a/src/lib.rs b/src/lib.rs index aab7b6e..1390701 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -6,17 +6,17 @@ //! `pt` is a project consisting of multiple smaller crates, all bundled together in this //! "main crate". Most crates will only show up if you activate their feature. -#[cfg(feature = "core")] -pub use libpt_core as core; #[cfg(feature = "bintols")] -pub use libpt_bintols as bintols; -#[cfg(feature = "hedu")] -pub use libpt_hedu as hedu; -#[cfg(feature = "log")] -pub use libpt_log as log; -#[cfg(feature = "math")] -pub use libpt_math as math; -#[cfg(feature = "net")] -pub use libpt_net as net; +pub use libpt_bintols as bintols; #[cfg(feature = "ccc")] -pub use libpt_ccc as ccc; +pub use libpt_ccc as ccc; +#[cfg(feature = "core")] +pub use libpt_core as core; +#[cfg(feature = "hedu")] +pub use libpt_hedu as hedu; +#[cfg(feature = "log")] +pub use libpt_log as log; +#[cfg(feature = "math")] +pub use libpt_math as math; +#[cfg(feature = "net")] +pub use libpt_net as net;