Skip to content

Commit

Permalink
Merge pull request #38 from pierresouchay/no_feat_reformat_all_code_w…
Browse files Browse the repository at this point in the history
…ith_cargo_fmt

[No Feature]: Reformat all code using cargo fmt
  • Loading branch information
stusmall authored Mar 9, 2020
2 parents 9ea1518 + 485ffab commit 5efcd95
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 16 deletions.
3 changes: 1 addition & 2 deletions src/agent.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
use std::collections::HashMap;


use crate::Client;
use crate::errors::Result;
use crate::request::{get, put};
use crate::Client;

#[serde(default)]
#[derive(Clone, Default, Eq, PartialEq, Serialize, Deserialize, Debug)]
Expand Down
10 changes: 8 additions & 2 deletions src/catalog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,10 @@ pub trait Catalog {
) -> Result<((), WriteMeta)>;
fn datacenters(&self) -> Result<(Vec<String>, QueryMeta)>;
fn nodes(&self, q: Option<&QueryOptions>) -> Result<(Vec<Node>, QueryMeta)>;
fn services(&self, q: Option<&QueryOptions>) -> Result<(HashMap<String, Vec<String>>, QueryMeta)>;
fn services(
&self,
q: Option<&QueryOptions>,
) -> Result<(HashMap<String, Vec<String>>, QueryMeta)>;
}

impl Catalog for Client {
Expand Down Expand Up @@ -139,7 +142,10 @@ impl Catalog for Client {
get("/v1/catalog/nodes", &self.config, HashMap::new(), q)
}

fn services(&self, q: Option<&QueryOptions>) -> Result<(HashMap<String, Vec<String>>, QueryMeta)> {
fn services(
&self,
q: Option<&QueryOptions>,
) -> Result<(HashMap<String, Vec<String>>, QueryMeta)> {
get("/v1/catalog/services", &self.config, HashMap::new(), q)
}
}
2 changes: 1 addition & 1 deletion src/connect_ca.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ use std::collections::HashMap;

use serde_json::Value;

use crate::{Client, QueryMeta, QueryOptions, WriteMeta, WriteOptions};
use crate::errors::Result;
use crate::request::{get, put};
use crate::{Client, QueryMeta, QueryOptions, WriteMeta, WriteOptions};

#[serde(default)]
#[derive(Default, Serialize, Deserialize, Debug)]
Expand Down
2 changes: 1 addition & 1 deletion src/health.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use std::collections::HashMap;

use crate::{Client, QueryMeta, QueryOptions};
use crate::agent::AgentService;
use crate::errors::Result;
use crate::request::get;
use crate::{Client, QueryMeta, QueryOptions};

#[serde(default)]
#[derive(Eq, Default, PartialEq, Serialize, Deserialize, Debug)]
Expand Down
2 changes: 1 addition & 1 deletion src/kv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pub struct KVPair {

pub trait KV {
fn acquire(&self, _: &KVPair, _: Option<&WriteOptions>) -> Result<(bool, WriteMeta)>;
fn delete(&self, _ : &str, _: Option<&WriteOptions>) -> Result<(bool, WriteMeta)>;
fn delete(&self, _: &str, _: Option<&WriteOptions>) -> Result<(bool, WriteMeta)>;
fn get(&self, _: &str, _: Option<&QueryOptions>) -> Result<(Option<KVPair>, QueryMeta)>;
fn list(&self, _: &str, _: Option<&QueryOptions>) -> Result<(Vec<KVPair>, QueryMeta)>;
fn put(&self, _: &KVPair, _: Option<&WriteOptions>) -> Result<(bool, WriteMeta)>;
Expand Down
8 changes: 2 additions & 6 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ extern crate error_chain;
#[macro_use]
extern crate serde_derive;


pub mod agent;
pub mod catalog;
pub mod connect_ca;
Expand All @@ -19,14 +18,11 @@ mod request;

use std::time::Duration;


use reqwest::ClientBuilder;
use reqwest::Client as HttpClient;
use reqwest::ClientBuilder;

use errors::{Result, ResultExt};



#[derive(Clone, Debug)]
pub struct Client {
config: Config,
Expand All @@ -48,7 +44,7 @@ pub struct Config {

impl Config {
pub fn new() -> Result<Config> {
ClientBuilder::new()
ClientBuilder::new()
.build()
.chain_err(|| "Failed to build reqwest client")
.map(|client| Config {
Expand Down
2 changes: 1 addition & 1 deletion src/request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ use reqwest::StatusCode;
use serde::de::DeserializeOwned;
use serde::Serialize;

use crate::{Config, QueryMeta, QueryOptions, WriteMeta, WriteOptions};
use crate::errors::{Result, ResultExt};
use crate::{Config, QueryMeta, QueryOptions, WriteMeta, WriteOptions};

pub fn get_vec<R: DeserializeOwned>(
path: &str,
Expand Down
4 changes: 2 additions & 2 deletions tests/catalog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ fn ds_services_test() {
let r = client.services(Option::None).unwrap();
assert_ne!(r.0.len(), 0);
match r.0.get("consul") {
None => panic!("Should have a Consul service"),
Some(val) => assert_eq!(val.len(), 0) // consul has no tags
None => panic!("Should have a Consul service"),
Some(val) => assert_eq!(val.len(), 0), // consul has no tags
}
}

0 comments on commit 5efcd95

Please sign in to comment.