From fd79e184ad3b67099ae09cda31f8a33cd2b9b77f Mon Sep 17 00:00:00 2001 From: Vincent Lafeychine <vincent.lafeychine@proton.me> Date: Mon, 29 Apr 2024 23:22:11 +0200 Subject: [PATCH] clippy: Fix bool_to_int_with_if --- rr_frontend/.cargo/config.toml | 1 - rr_frontend/attribute_parse/src/parse.rs | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/rr_frontend/.cargo/config.toml b/rr_frontend/.cargo/config.toml index 90f3c3d6..8afe9850 100644 --- a/rr_frontend/.cargo/config.toml +++ b/rr_frontend/.cargo/config.toml @@ -32,7 +32,6 @@ rustflags = [ "-Aclippy::string_lit_as_bytes", # clippy::pedantic - "-Aclippy::bool_to_int_with_if", "-Aclippy::cast_lossless", "-Aclippy::cloned_instead_of_copied", "-Aclippy::default_trait_access", diff --git a/rr_frontend/attribute_parse/src/parse.rs b/rr_frontend/attribute_parse/src/parse.rs index 2f182e98..b46b6a69 100644 --- a/rr_frontend/attribute_parse/src/parse.rs +++ b/rr_frontend/attribute_parse/src/parse.rs @@ -741,7 +741,7 @@ impl<T, P> Punctuated<T, P> { /// This is the number of nodes of type `T`, not counting the punctuation of /// type `P`. pub fn len(&self) -> usize { - self.inner.len() + if self.last.is_some() { 1 } else { 0 } + self.inner.len() + usize::from(self.last.is_some()) } /// Borrows the first element in this sequence. -- GitLab