diff --git a/Cargo.toml b/Cargo.toml index 57314ef8ddd..5364e8bac05 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,12 +16,15 @@ name = "cmn" path = "src/rust/lib.rs" [dependencies] +clap = "*" hyper = "*" mime = "*" rustc-serialize = "*" -yup-oauth2 = "*" +yup-oauth2 = { version = "*", features = ["nightly"], default-features = false } serde = "*" +serde_json = "*" serde_macros = "*" +strsim = "*" [dev-dependencies] yup-hyper-mock = "*" diff --git a/src/rust/cli/cmn.rs b/src/rust/cli/cmn.rs index eaaeeb060f7..2cf4fbacf2a 100644 --- a/src/rust/cli/cmn.rs +++ b/src/rust/cli/cmn.rs @@ -433,7 +433,7 @@ impl TokenStorage for JsonTokenStorage { fn get(&self, scope_hash: u64, _: &Vec<&str>) -> Result, json::Error> { match fs::File::open(&self.path(scope_hash)) { - Ok(mut f) => { + Ok(f) => { match json::de::from_reader(f) { Ok(token) => Ok(Some(token)), Err(err) => Err(err), @@ -578,7 +578,7 @@ impl fmt::Display for CLIError { => writeln!(f, "Failed to parse argument '{}' with value '{}' as {} with error: {}.", arg_name, value, type_name, err_desc), CLIError::UnknownParameter(ref param_name, ref possible_values) => { - let mut suffix = + let suffix = match did_you_mean(param_name, &possible_values) { Some(v) => format!(" Did you mean '{}' ?", v), None => String::new(), @@ -692,7 +692,7 @@ pub fn application_secret_from_directory(dir: &str, } return secret_io_error(err) }, - Ok(mut f) => { + Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { Err(json::Error::IoError(err)) => return secret_io_error(err), diff --git a/src/rust/lib.rs b/src/rust/lib.rs index 94d59956dca..61c5653aea8 100644 --- a/src/rust/lib.rs +++ b/src/rust/lib.rs @@ -2,12 +2,18 @@ #![allow(dead_code, deprecated, unused_features, unused_variables, unused_imports)] //! library with code shared by all generated implementations #![plugin(serde_macros)] + +#[macro_use] +extern crate clap; + #[macro_use] extern crate hyper; extern crate mime; extern crate rustc_serialize; extern crate yup_oauth2 as oauth2; extern crate serde; +extern crate serde_json; +extern crate strsim; // just pull it in the check if it compiles mod api; @@ -194,4 +200,4 @@ mod test_cli { assert_eq!(c.num_fields(), 3); assert_eq!(c.to_string(), "one.beer.one"); } -} \ No newline at end of file +}