Rust 2024 let-chains to simplify wait Conditions #4012
Annotations
3 errors and 10 warnings
|
clippy_nightly
Error: Clippy has exited with exit code 101
|
|
this `if` statement can be collapsed:
kube-runtime/src/watcher.rs#L494
error: this `if` statement can be collapsed
--> kube-runtime/src/watcher.rs:494:13
|
494 | / if continue_token.is_none() {
495 | | if let Some(resource_version) = last_bookmark {
496 | | // we have drained the last page - move on to next stage
497 | | return (Some(Ok(Event::InitDone)), State::InitListed { resource_version });
498 | | }
499 | | }
| |_____________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if
help: collapse nested if block
|
494 ~ if continue_token.is_none()
495 ~ && let Some(resource_version) = last_bookmark {
496 | // we have drained the last page - move on to next stage
497 | return (Some(Ok(Event::InitDone)), State::InitListed { resource_version });
498 ~ }
|
|
|
this `if` statement can be collapsed:
kube-runtime/src/utils/backoff_reset_timer.rs#L36
error: this `if` statement can be collapsed
--> kube-runtime/src/utils/backoff_reset_timer.rs:36:9
|
36 | / if let Some(last_backoff) = self.last_backoff {
37 | | if tokio::time::Instant::now().into_std() > last_backoff + self.reset_duration {
38 | | tracing::debug!(
39 | | ?last_backoff,
... |
45 | | }
| |_________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if
note: the lint level is defined here
--> kube-runtime/src/lib.rs:11:9
|
11 | #![deny(clippy::all)]
| ^^^^^^^^^^^
= note: `#[deny(clippy::collapsible_if)]` implied by `#[deny(clippy::all)]`
help: collapse nested if block
|
36 ~ if let Some(last_backoff) = self.last_backoff
37 ~ && tokio::time::Instant::now().into_std() > last_backoff + self.reset_duration {
38 | tracing::debug!(
...
43 | self.backoff.reset();
44 ~ }
|
|
|
this `if` statement can be collapsed:
kube-core/src/discovery.rs#L134
warning: this `if` statement can be collapsed
--> kube-core/src/discovery.rs:134:9
|
134 | / if let Some(c) = word.chars().nth(word.len() - 2) {
135 | | if !matches!(c, 'a' | 'e' | 'i' | 'o' | 'u') {
136 | | // Remove 'y' and add `ies`
137 | | let mut chars = word.chars();
... |
141 | | }
| |_________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if
help: collapse nested if block
|
134 ~ if let Some(c) = word.chars().nth(word.len() - 2)
135 ~ && !matches!(c, 'a' | 'e' | 'i' | 'o' | 'u') {
136 | // Remove 'y' and add `ies`
...
139 | return format!("{}ies", chars.as_str());
140 ~ }
|
|
|
this `if` statement can be collapsed:
kube-core/src/discovery.rs#L133
warning: this `if` statement can be collapsed
--> kube-core/src/discovery.rs:133:5
|
133 | / if word.ends_with('y') {
134 | | if let Some(c) = word.chars().nth(word.len() - 2) {
135 | | if !matches!(c, 'a' | 'e' | 'i' | 'o' | 'u') {
... |
142 | | }
| |_____^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if
= note: `#[warn(clippy::collapsible_if)]` on by default
help: collapse nested if block
|
133 ~ if word.ends_with('y')
134 ~ && let Some(c) = word.chars().nth(word.len() - 2) {
135 | if !matches!(c, 'a' | 'e' | 'i' | 'o' | 'u') {
...
140 | }
141 ~ }
|
|
|
this `if` statement can be collapsed:
kube-derive/src/custom_resource.rs#L913
warning: this `if` statement can be collapsed
--> kube-derive/src/custom_resource.rs:913:9
|
913 | / if let Some(c) = word.chars().nth(word.len() - 2) {
914 | | if !matches!(c, 'a' | 'e' | 'i' | 'o' | 'u') {
915 | | // Remove 'y' and add `ies`
916 | | let mut chars = word.chars();
... |
920 | | }
| |_________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if
help: collapse nested if block
|
913 ~ if let Some(c) = word.chars().nth(word.len() - 2)
914 ~ && !matches!(c, 'a' | 'e' | 'i' | 'o' | 'u') {
915 | // Remove 'y' and add `ies`
...
918 | return format!("{}ies", chars.as_str());
919 ~ }
|
|
|
this `if` statement can be collapsed:
kube-derive/src/custom_resource.rs#L912
warning: this `if` statement can be collapsed
--> kube-derive/src/custom_resource.rs:912:5
|
912 | / if word.ends_with('y') {
913 | | if let Some(c) = word.chars().nth(word.len() - 2) {
914 | | if !matches!(c, 'a' | 'e' | 'i' | 'o' | 'u') {
... |
921 | | }
| |_____^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if
help: collapse nested if block
|
912 ~ if word.ends_with('y')
913 ~ && let Some(c) = word.chars().nth(word.len() - 2) {
914 | if !matches!(c, 'a' | 'e' | 'i' | 'o' | 'u') {
...
919 | }
920 ~ }
|
|
|
this `if` statement can be collapsed:
kube-derive/src/custom_resource.rs#L348
warning: this `if` statement can be collapsed
--> kube-derive/src/custom_resource.rs:348:9
|
348 | / if let Some(ident) = meta.path().get_ident() {
349 | | if NOT_ALLOWED_ATTRIBUTES.iter().any(|el| ident == el) {
350 | | if ident == "derive" {
351 | | return Err(darling::Error::custom(
... |
359 | | }
| |_________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if
help: collapse nested if block
|
348 ~ if let Some(ident) = meta.path().get_ident()
349 ~ && NOT_ALLOWED_ATTRIBUTES.iter().any(|el| ident == el) {
350 | if ident == "derive" {
...
357 | )));
358 ~ }
|
|
|
this `if` statement can be collapsed:
kube-derive/src/custom_resource.rs#L80
warning: this `if` statement can be collapsed
--> kube-derive/src/custom_resource.rs:80:9
|
80 | / if items.len() == 2 {
81 | | if let (
82 | | darling::ast::NestedMeta::Lit(syn::Lit::Str(key)),
83 | | darling::ast::NestedMeta::Lit(syn::Lit::Str(value)),
... |
88 | | }
| |_________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if
= note: `#[warn(clippy::collapsible_if)]` on by default
help: collapse nested if block
|
80 ~ if items.len() == 2
81 ~ && let (
82 | darling::ast::NestedMeta::Lit(syn::Lit::Str(key)),
...
86 | return Ok(KVTuple(key.value(), value.value()));
87 ~ }
|
|
|
this `if` statement can be collapsed:
kube-derive/src/custom_resource.rs#L913
warning: this `if` statement can be collapsed
--> kube-derive/src/custom_resource.rs:913:9
|
913 | / if let Some(c) = word.chars().nth(word.len() - 2) {
914 | | if !matches!(c, 'a' | 'e' | 'i' | 'o' | 'u') {
915 | | // Remove 'y' and add `ies`
916 | | let mut chars = word.chars();
... |
920 | | }
| |_________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if
help: collapse nested if block
|
913 ~ if let Some(c) = word.chars().nth(word.len() - 2)
914 ~ && !matches!(c, 'a' | 'e' | 'i' | 'o' | 'u') {
915 | // Remove 'y' and add `ies`
...
918 | return format!("{}ies", chars.as_str());
919 ~ }
|
|
|
this `if` statement can be collapsed:
kube-derive/src/custom_resource.rs#L912
warning: this `if` statement can be collapsed
--> kube-derive/src/custom_resource.rs:912:5
|
912 | / if word.ends_with('y') {
913 | | if let Some(c) = word.chars().nth(word.len() - 2) {
914 | | if !matches!(c, 'a' | 'e' | 'i' | 'o' | 'u') {
... |
921 | | }
| |_____^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if
help: collapse nested if block
|
912 ~ if word.ends_with('y')
913 ~ && let Some(c) = word.chars().nth(word.len() - 2) {
914 | if !matches!(c, 'a' | 'e' | 'i' | 'o' | 'u') {
...
919 | }
920 ~ }
|
|
|
this `if` statement can be collapsed:
kube-derive/src/custom_resource.rs#L348
warning: this `if` statement can be collapsed
--> kube-derive/src/custom_resource.rs:348:9
|
348 | / if let Some(ident) = meta.path().get_ident() {
349 | | if NOT_ALLOWED_ATTRIBUTES.iter().any(|el| ident == el) {
350 | | if ident == "derive" {
351 | | return Err(darling::Error::custom(
... |
359 | | }
| |_________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if
help: collapse nested if block
|
348 ~ if let Some(ident) = meta.path().get_ident()
349 ~ && NOT_ALLOWED_ATTRIBUTES.iter().any(|el| ident == el) {
350 | if ident == "derive" {
...
357 | )));
358 ~ }
|
|
|
this `if` statement can be collapsed:
kube-derive/src/custom_resource.rs#L80
warning: this `if` statement can be collapsed
--> kube-derive/src/custom_resource.rs:80:9
|
80 | / if items.len() == 2 {
81 | | if let (
82 | | darling::ast::NestedMeta::Lit(syn::Lit::Str(key)),
83 | | darling::ast::NestedMeta::Lit(syn::Lit::Str(value)),
... |
88 | | }
| |_________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if
= note: `#[warn(clippy::collapsible_if)]` on by default
help: collapse nested if block
|
80 ~ if items.len() == 2
81 ~ && let (
82 | darling::ast::NestedMeta::Lit(syn::Lit::Str(key)),
...
86 | return Ok(KVTuple(key.value(), value.value()));
87 ~ }
|
|