diff --git a/Cargo.toml b/Cargo.toml index 4d95072..a4bd531 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,15 +13,11 @@ sodiumoxide = { git = "https://github.com/Dhole/sodiumoxidez", branch = "extra" base64 = "0.11.0" hex = "0.4.0" async-std = { version = "1.5.0", features=["unstable","attributes"] } -crossbeam = "0.7.3" log = "0.4.8" -env_logger = "0.7.1" serde = { version = "1.0.104", features = ["derive"] } serde_json = { version = "1.0.48", features=["preserve_order","arbitrary_precision"] } dirs = "2.0" futures = "0.3.4" -lazy_static = "1.4.0" -rand = "0.7.3" get_if_addrs = "0.5.3" regex = "1.3.7" once_cell = "1.3.1" @@ -32,5 +28,8 @@ thiserror = "1.0.20" name = "ssb-cli" [dev-dependencies] +crossbeam = "0.7.3" +env_logger = "0.7.1" structopt = "0.3.9" regex = "1.3.4" +rand = "0.7.3" diff --git a/examples/ssb-cli.rs b/examples/ssb-cli.rs index dcc5552..8811f03 100644 --- a/examples/ssb-cli.rs +++ b/examples/ssb-cli.rs @@ -27,7 +27,7 @@ use regex::Regex; use sodiumoxide::crypto::sign::ed25519; use structopt::StructOpt; -type SolarResult = std::result::Result>; +type Result = std::result::Result>; #[derive(Debug, StructOpt)] #[structopt(name = "example", about = "An example of StructOpt usage.")] @@ -38,16 +38,16 @@ struct Opt { connect: Option, } -pub fn whoami_res_parse(body: &[u8]) -> SolarResult { +pub fn whoami_res_parse(body: &[u8]) -> Result { Ok(serde_json::from_slice(body)?) } -pub fn message_res_parse(body: &[u8]) -> SolarResult { +pub fn message_res_parse(body: &[u8]) -> Result { Ok(Message::from_slice(body)?) } -pub fn feed_res_parse(body: &[u8]) -> SolarResult { +pub fn feed_res_parse(body: &[u8]) -> Result { Ok(Feed::from_slice(&body)?) } -pub fn latest_res_parse(body: &[u8]) -> SolarResult { +pub fn latest_res_parse(body: &[u8]) -> Result { Ok(serde_json::from_slice(body)?) } @@ -71,14 +71,10 @@ impl std::fmt::Display for AppError { } } -async fn get_async<'a, R, T, F>( - rpc_reader: &mut RpcReader, - req_no: RequestNo, - f: F, -) -> SolarResult +async fn get_async<'a, R, T, F>(rpc_reader: &mut RpcReader, req_no: RequestNo, f: F) -> Result where R: Read + Unpin, - F: Fn(&[u8]) -> SolarResult, + F: Fn(&[u8]) -> Result, T: Debug, { loop { @@ -101,10 +97,10 @@ async fn print_source_until_eof<'a, R, T, F>( rpc_reader: &mut RpcReader, req_no: RequestNo, f: F, -) -> SolarResult<()> +) -> Result<()> where R: Read + Unpin, - F: Fn(&[u8]) -> SolarResult, + F: Fn(&[u8]) -> Result, T: Debug + serde::Deserialize<'a>, { loop { @@ -127,7 +123,7 @@ where } #[async_std::main] -async fn main() -> SolarResult<()> { +async fn main() -> Result<()> { env_logger::init(); log::set_max_level(log::LevelFilter::max()); diff --git a/pre_commit.sh b/pre_commit.sh index 4cf222e..4da677f 100755 --- a/pre_commit.sh +++ b/pre_commit.sh @@ -1,4 +1,5 @@ cargo test cargo fmt --all cargo clippy +cargo +nightly udeps cargo audit