Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,507 changes: 1,034 additions & 473 deletions Cargo.lock

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions src/command/rollouts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ impl Resource for RolloutValue {
#[derive(Debug)]
pub enum ReadNamespacedRolloutValueResponse {
Ok(Box<RolloutValue>),
#[allow(dead_code)]
Other(Result<Option<Value>, Error>),
}

Expand Down
4 changes: 1 addition & 3 deletions src/command/services.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,8 @@ fn service_external_ip(service: &api::Service) -> Option<CellSpec<'_>> {
.map(|ingress| {
if let Some(hv) = ingress.hostname.as_deref() {
hv
} else if let Some(ipv) = ingress.ip.as_deref() {
ipv
} else {
""
ingress.ip.as_deref().unwrap_or_default()
}
})
.collect::<Vec<&str>>()
Expand Down
5 changes: 2 additions & 3 deletions src/command_processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ pub fn alias_expand_line(env: &Env, line: &str) -> String {
rests.concat()
}

fn parse_line(line: &str) -> Result<(&str, RightExpr), ClickError> {
fn parse_line(line: &str) -> Result<(&str, RightExpr<'_>), ClickError> {
let parser = Parser::new(line);
for (range, sep, _) in parser {
match sep {
Expand Down Expand Up @@ -607,8 +607,7 @@ mod tests {
}

fn get_processor() -> CommandProcessor {
let mut commands: Vec<Box<dyn Cmd>> = Vec::new();
commands.push(Box::new(TestCmd));
let commands: Vec<Box<dyn Cmd>> = vec![Box::new(TestCmd)];
CommandProcessor::new_with_commands(
Env::new(
get_test_config(),
Expand Down
2 changes: 1 addition & 1 deletion src/config/click.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ aliases:
assert_eq!(config.completiontype, CompletionType::List);
assert_eq!(config.aliases.len(), 1);
assert_eq!(config.range_separator, default_range_sep());
let a = config.aliases.get(0).unwrap();
let a = config.aliases.first().unwrap();
assert_eq!(a.alias, "pn");
assert_eq!(a.expanded, "pods --sort node");
assert_eq!(config.connect_timeout_secs, default_connect_timeout());
Expand Down
15 changes: 9 additions & 6 deletions src/config/kubefile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -603,6 +603,8 @@ impl ExecProvider {

#[cfg(test)]
pub mod tests {
use chrono::{offset::LocalResult, NaiveDateTime};

use super::*;

static TEST_CONFIG: &str = r#"apiVersion: v1
Expand Down Expand Up @@ -1003,12 +1005,13 @@ users:
);

let e = AuthProviderGcpConfig::parse_expiry("2018-04-01 5:57:31");
assert_eq!(
e.unwrap(),
Local
.datetime_from_str("2018-04-01 5:57:31", "%Y-%m-%d %H:%M:%S")
.unwrap()
);
let expected = match Local.from_local_datetime(
&NaiveDateTime::parse_from_str("2018-04-01 5:57:31", "%Y-%m-%d %H:%M:%S").unwrap(),
) {
LocalResult::Single(d) => d,
_ => panic!("Couldn't parse expected"),
};
assert_eq!(e.unwrap(), expected,);

let fe = AuthProviderGcpConfig::parse_expiry("INVALID");
assert!(fe.is_err());
Expand Down
1 change: 1 addition & 0 deletions src/crd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ pub fn get_api_group_resources(
#[derive(Debug)]
pub enum GetAPIGroupResourcesResponse {
Ok(APIResourceList),
#[allow(dead_code)]
Other(Result<Option<serde_json::Value>, serde_json::Error>),
}

Expand Down
15 changes: 7 additions & 8 deletions src/describe/legacy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
ObjectCreated,
CustomFunc {
path: Option<&'a str>,
func: &'a (dyn Fn(&Value) -> Cow<str>),

Check warning on line 52 in src/describe/legacy.rs

View workflow job for this annotation

GitHub Actions / Click Beta Check

unnecessary parentheses around type

Check warning on line 52 in src/describe/legacy.rs

View workflow job for this annotation

GitHub Actions / Click Beta Test Suite OSX

unnecessary parentheses around type

Check warning on line 52 in src/describe/legacy.rs

View workflow job for this annotation

GitHub Actions / Click Beta Test Suite

unnecessary parentheses around type
default: &'a str,
},
}
Expand Down Expand Up @@ -286,7 +286,7 @@
}

/// Get volume info out of volume array
fn get_volume_str(v: &Value) -> Cow<str> {
fn get_volume_str(v: &'_ Value) -> Cow<'_, str> {
let mut buf = String::new();
if let Some(vol_arry) = v.as_array() {
for vol in vol_arry.iter() {
Expand Down Expand Up @@ -355,7 +355,7 @@
buf.into()
}

fn pod_phase(v: &Value) -> Cow<str> {
fn pod_phase(v: &'_ Value) -> Cow<'_, str> {
// TODO: How to get an env in here for the colors
let phase_str = val_str("/status/phase", v, "<No Phase>");
match &*phase_str {
Expand Down Expand Up @@ -422,7 +422,7 @@
Ok(())
}

fn node_access_url(v: &Value) -> Cow<str> {
fn node_access_url(v: &'_ Value) -> Cow<'_, str> {
match val_str_opt("/spec/providerID", v) {
Some(provider) => {
if provider.starts_with("aws://") {
Expand All @@ -431,9 +431,8 @@
addr_vec
.iter()
.find(|&aval| {
aval.as_object().map_or(false, |addr| {
addr["type"].as_str().map_or(false, |t| t == "ExternalIP")
})
aval.as_object()
.is_some_and(|addr| addr["type"].as_str() == Some("ExternalIP"))
})
.and_then(|v| v.pointer("/address").and_then(|a| a.as_str()))
})
Expand Down Expand Up @@ -513,7 +512,7 @@
}

/// Get container info out of container array
fn get_container_str(v: &Value) -> Cow<str> {
fn get_container_str(v: &'_ Value) -> Cow<'_, str> {
let mut buf = String::new();
if let Some(container_array) = v.as_array() {
for container in container_array.iter() {
Expand All @@ -533,7 +532,7 @@
}

/// Get status messages out of 'conditions' array
fn get_message_str(v: &Value) -> Cow<str> {
fn get_message_str(v: &'_ Value) -> Cow<'_, str> {
let mut buf = String::new();
if let Some(condition_array) = v.as_array() {
for condition in condition_array.iter() {
Expand Down
4 changes: 2 additions & 2 deletions src/describe/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ pub mod service;

pub static NOTSUPPORTED: &str = "not supported without -j or -y yet\n";

pub fn maybe_full_describe_output<T: ?Sized>(
pub fn maybe_full_describe_output<T>(
matches: &ArgMatches,
value: &T,
writer: &mut ClickWriter,
) -> bool
where
T: Serialize,
T: Serialize + ?Sized,
{
if matches.contains_id("json") {
writer.pretty_color_json(value).unwrap_or(());
Expand Down
2 changes: 1 addition & 1 deletion src/describe/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ fn describe_format_service(
}

/// Get ports info out of ports array
fn get_ports_str(v: Option<&Value>, endpoint_val: Option<Value>) -> Cow<str> {
fn get_ports_str(v: Option<&'_ Value>, endpoint_val: Option<Value>) -> Cow<'_, str> {
if v.is_none() {
return "<none>".into();
}
Expand Down
2 changes: 1 addition & 1 deletion src/env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ impl Env {
self.port_forwards.push(pf);
}

pub fn get_port_forwards(&mut self) -> std::slice::IterMut<PortForward> {
pub fn get_port_forwards(&mut self) -> std::slice::IterMut<'_, PortForward> {
self.port_forwards.iter_mut()
}

Expand Down
1 change: 1 addition & 0 deletions src/k8s_table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ impl K8sTable {
#[derive(Debug)]
pub enum GetTableResponse {
Ok(K8sTable),
#[allow(dead_code)]
Other(Result<Option<serde_json::Value>, serde_json::Error>),
}

Expand Down
Loading
Loading