regenerate everything

This commit is contained in:
Sebastian Thiel
2021-04-14 10:10:59 +08:00
parent 65f9c22094
commit 34096d3862
2792 changed files with 149735 additions and 162953 deletions

View File

@@ -5,7 +5,6 @@ use mime::Mime;
use oauth2::{ApplicationSecret, ConsoleApplicationSecret};
use serde_json as json;
use serde_json::value::Value;
use strsim;
use std::env;
use std::error::Error as StdError;
@@ -143,7 +142,7 @@ impl From<&'static str> for FieldCursor {
}
}
fn assure_entry<'a, 'b>(m: &'a mut json::Map<String, Value>, k: &'b String) -> &'a mut Value {
fn assure_entry<'a>(m: &'a mut json::Map<String, Value>, k: &str) -> &'a mut Value {
if m.contains_key(k) {
return m.get_mut(k).expect("value to exist");
}
@@ -153,7 +152,7 @@ fn assure_entry<'a, 'b>(m: &'a mut json::Map<String, Value>, k: &'b String) -> &
impl FieldCursor {
pub fn set(&mut self, value: &str) -> Result<(), CLIError> {
if value.len() == 0 {
if value.is_empty() {
return Err(CLIError::Field(FieldError::Empty));
}
@@ -166,7 +165,7 @@ impl FieldCursor {
let mut fields = self.0.clone();
let push_field = |fs: &mut Vec<String>, f: &mut String| {
if f.len() > 0 {
if !f.is_empty() {
fs.push(f.clone());
f.truncate(0);
}
@@ -189,10 +188,8 @@ impl FieldCursor {
}
} else {
num_conscutive_field_seps = 0;
if cid == 1 {
if first_is_field_sep {
fields.truncate(0);
}
if cid == 1 && first_is_field_sep {
fields.truncate(0);
}
field.push(c);
}
@@ -216,7 +213,7 @@ impl FieldCursor {
}
pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option<String> {
if value.len() == 0 {
if value.is_empty() {
return None;
}
@@ -226,7 +223,7 @@ impl FieldCursor {
let mut output = String::new();
let push_field = |fs: &mut String, f: &mut String| {
if f.len() > 0 {
if !f.is_empty() {
fs.push_str(match did_you_mean(&f, possible_values) {
Some(candidate) => candidate,
None => &f,
@@ -250,7 +247,7 @@ impl FieldCursor {
push_field(&mut output, &mut field);
if &output == value {
if output == value {
None
} else {
Some(output)
@@ -265,7 +262,7 @@ impl FieldCursor {
err: &mut InvalidOptionsError,
orig_cursor: &FieldCursor,
) {
assert!(self.0.len() > 0);
assert!(!self.0.is_empty());
for field in &self.0[..self.0.len() - 1] {
let tmp = object;
@@ -355,7 +352,7 @@ pub fn parse_kv_arg<'a>(
match kv.find('=') {
None => {
add_err();
return (kv, None);
(kv, None)
}
Some(pos) => {
let key = &kv[..pos];
@@ -600,7 +597,7 @@ impl fmt::Display for CLIError {
Some(v) => format!(" Did you mean '{}' ?", v),
None => String::new(),
};
write!(f, "Parameter '{}' is unknown.{}\n", param_name, suffix)
writeln!(f, "Parameter '{}' is unknown.{}", param_name, suffix)
}
CLIError::InvalidKeyValueSyntax(ref kv, is_hashmap) => {
let hashmap_info = if is_hashmap { "hashmap " } else { "" };
@@ -639,7 +636,7 @@ impl InvalidOptionsError {
pub fn single(err: CLIError, exit_code: i32) -> InvalidOptionsError {
InvalidOptionsError {
issues: vec![err],
exit_code: exit_code,
exit_code,
}
}
@@ -653,12 +650,15 @@ impl InvalidOptionsError {
pub fn assure_config_dir_exists(dir: &str) -> Result<String, CLIError> {
let trdir = dir.trim();
if trdir.len() == 0 {
if trdir.is_empty() {
return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset));
}
let expanded_config_dir = if trdir.as_bytes()[0] == b'~' {
match env::var("HOME").ok().or(env::var("UserProfile").ok()) {
match env::var("HOME")
.ok()
.or_else(|| env::var("UserProfile").ok())
{
None => {
return Err(CLIError::Configuration(
ConfigurationError::HomeExpansionFailed(trdir.to_string()),

View File

@@ -34,8 +34,7 @@ enum DoitError {
struct Engine<'n> {
opt: ArgMatches<'n>,
hub: api::Taskqueue<hyper::Client<hyper_rustls::HttpsConnector<hyper::client::connect::HttpConnector>, hyper::body::Body>
>,
hub: api::Taskqueue,
gp: Vec<&'static str>,
gpm: Vec<(&'static str, &'static str)>,
}
@@ -992,7 +991,7 @@ async fn main() {
let mut app = App::new("taskqueue1-beta2")
.author("Sebastian Thiel <byronimo@gmail.com>")
.version("2.0.0+20160428")
.version("2.0.3+20160428")
.about("Accesses a Google App Engine Pull Task Queue over REST.")
.after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_taskqueue1_beta2_cli")
.arg(Arg::with_name("url")