From d2e9aaf76629d828da90777c741387211a4c1cdb Mon Sep 17 00:00:00 2001 From: Hasnain Lakhani Date: Mon, 8 Jan 2024 11:56:43 -0800 Subject: [PATCH] fix clippy --- src/config/kubefile.rs | 4 ++-- src/env.rs | 2 +- src/table.rs | 2 ++ 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/config/kubefile.rs b/src/config/kubefile.rs index 2ebb506..efa47e5 100644 --- a/src/config/kubefile.rs +++ b/src/config/kubefile.rs @@ -424,11 +424,11 @@ impl AuthProviderGcpConfig { fn update_token(&self, token: &mut Option, expiry: &mut Option>) { match self.cmd_path { Some(ref conf_cmd) => { - let args = self + let args: Vec<_> = self .cmd_args .as_ref() .map(|argstr| argstr.split_whitespace().collect()) - .unwrap_or_else(Vec::new); + .unwrap_or_default(); match ductcmd(conf_cmd, &args).read() { Ok(output) => { self.parse_output_and_update(output.as_str(), token, expiry); diff --git a/src/env.rs b/src/env.rs index 2e70413..79d3698 100644 --- a/src/env.rs +++ b/src/env.rs @@ -319,7 +319,7 @@ impl Env { let range_str = if range.is_empty() { "Empty range".to_string() } else { - let mut r = format!("{} {}", range.len(), range.get(0).unwrap().type_str()); + let mut r = format!("{} {}", range.len(), range.first().unwrap().type_str()); if range.len() > 1 { r.push('s'); } diff --git a/src/table.rs b/src/table.rs index 272a7f3..4f42222 100644 --- a/src/table.rs +++ b/src/table.rs @@ -306,6 +306,8 @@ impl<'a> PartialEq for CellSpec<'a> { } impl<'a> Eq for CellSpec<'a> {} +// We ensure they are in sync (see impl for `Ord`), but clippy doesn't seem to recognize this. +#[allow(clippy::non_canonical_partial_ord_impl)] impl<'a> PartialOrd for CellSpec<'a> { fn partial_cmp(&self, other: &Self) -> Option { match (&self.txt, &other.txt) {