project cleanup

This commit is contained in:
adria0 2020-06-20 21:43:21 +02:00
parent 81467b27d1
commit afa748c08c
3 changed files with 14 additions and 18 deletions

View File

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

View File

@ -27,7 +27,7 @@ use regex::Regex;
use sodiumoxide::crypto::sign::ed25519;
use structopt::StructOpt;
type SolarResult<T> = std::result::Result<T, Box<dyn std::error::Error>>;
type Result<T> = std::result::Result<T, Box<dyn std::error::Error>>;
#[derive(Debug, StructOpt)]
#[structopt(name = "example", about = "An example of StructOpt usage.")]
@ -38,16 +38,16 @@ struct Opt {
connect: Option<String>,
}
pub fn whoami_res_parse(body: &[u8]) -> SolarResult<WhoAmIOut> {
pub fn whoami_res_parse(body: &[u8]) -> Result<WhoAmIOut> {
Ok(serde_json::from_slice(body)?)
}
pub fn message_res_parse(body: &[u8]) -> SolarResult<Message> {
pub fn message_res_parse(body: &[u8]) -> Result<Message> {
Ok(Message::from_slice(body)?)
}
pub fn feed_res_parse(body: &[u8]) -> SolarResult<Feed> {
pub fn feed_res_parse(body: &[u8]) -> Result<Feed> {
Ok(Feed::from_slice(&body)?)
}
pub fn latest_res_parse(body: &[u8]) -> SolarResult<LatestOut> {
pub fn latest_res_parse(body: &[u8]) -> Result<LatestOut> {
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<R>,
req_no: RequestNo,
f: F,
) -> SolarResult<T>
async fn get_async<'a, R, T, F>(rpc_reader: &mut RpcReader<R>, req_no: RequestNo, f: F) -> Result<T>
where
R: Read + Unpin,
F: Fn(&[u8]) -> SolarResult<T>,
F: Fn(&[u8]) -> Result<T>,
T: Debug,
{
loop {
@ -101,10 +97,10 @@ async fn print_source_until_eof<'a, R, T, F>(
rpc_reader: &mut RpcReader<R>,
req_no: RequestNo,
f: F,
) -> SolarResult<()>
) -> Result<()>
where
R: Read + Unpin,
F: Fn(&[u8]) -> SolarResult<T>,
F: Fn(&[u8]) -> Result<T>,
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());

View File

@ -1,4 +1,5 @@
cargo test
cargo fmt --all
cargo clippy
cargo +nightly udeps
cargo audit