From afb1401500e4d2bab6e8af127502774c659a0af8 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Fri, 12 Apr 2019 18:14:48 -0700 Subject: [PATCH] clippy: Resolve if_same_then_else Suppressing the lint locally because by the author's and reviewers' judgement this was the clearest way to write this code. The lint is still valuable for catching mistakes in copied and pasted code elsewhere. TEST=bin/clippy Change-Id: I77477fce51571220fd6259072519b31764a15aeb Reviewed-on: https://chromium-review.googlesource.com/1566737 Commit-Ready: David Tolnay Tested-by: David Tolnay Tested-by: kokoro Reviewed-by: Daniel Verkamp --- bin/clippy | 1 - devices/src/virtio/queue.rs | 1 + vhost/src/lib.rs | 1 + 3 files changed, 2 insertions(+), 1 deletion(-) diff --git a/bin/clippy b/bin/clippy index fbf5dc7666..148f8bb1c1 100755 --- a/bin/clippy +++ b/bin/clippy @@ -39,7 +39,6 @@ SUPPRESS=( # To be resolved or suppressed locally. cast_ptr_alignment - if_same_then_else ptr_arg # We don't care about these lints. Okay to remain suppressed globally. diff --git a/devices/src/virtio/queue.rs b/devices/src/virtio/queue.rs index 7d00b3473d..851077dea5 100644 --- a/devices/src/virtio/queue.rs +++ b/devices/src/virtio/queue.rs @@ -111,6 +111,7 @@ impl<'a> DescriptorChain<'a> { } } + #[allow(clippy::if_same_then_else)] fn is_valid(&self) -> bool { if self .mem diff --git a/vhost/src/lib.rs b/vhost/src/lib.rs index 917e1dc328..35256f9e3e 100644 --- a/vhost/src/lib.rs +++ b/vhost/src/lib.rs @@ -165,6 +165,7 @@ pub trait Vhost: AsRawFd + std::marker::Sized { } // TODO(smbarber): This is copypasta. Eliminate the copypasta. + #[allow(clippy::if_same_then_else)] fn is_valid( &self, queue_max_size: u16,