summary refs log tree commit diff
diff options
context:
space:
mode:
authorDavid Tolnay <dtolnay@chromium.org>2019-04-12 16:52:48 -0700
committerchrome-bot <chrome-bot@chromium.org>2019-04-15 02:06:09 -0700
commit79a2a2d7b44f1e49a83fdf527dd554f3bef704bc (patch)
treef0d6efa19c4e1b9e7b71bbc6d4792ed294970938
parent39acbdd53d7242130f14dfc5e301ddfb03218b8b (diff)
downloadcrosvm-79a2a2d7b44f1e49a83fdf527dd554f3bef704bc.tar
crosvm-79a2a2d7b44f1e49a83fdf527dd554f3bef704bc.tar.gz
crosvm-79a2a2d7b44f1e49a83fdf527dd554f3bef704bc.tar.bz2
crosvm-79a2a2d7b44f1e49a83fdf527dd554f3bef704bc.tar.lz
crosvm-79a2a2d7b44f1e49a83fdf527dd554f3bef704bc.tar.xz
crosvm-79a2a2d7b44f1e49a83fdf527dd554f3bef704bc.tar.zst
crosvm-79a2a2d7b44f1e49a83fdf527dd554f3bef704bc.zip
clippy: Resolve absurd_extreme_comparisons
TEST=bin/clippy

Change-Id: I838792f228bb7b6d64ac1a3511a0dcbc551aad40
Reviewed-on: https://chromium-review.googlesource.com/1566735
Commit-Ready: David Tolnay <dtolnay@chromium.org>
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: David Tolnay <dtolnay@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Zach Reizner <zachr@chromium.org>
-rwxr-xr-xbin/clippy1
-rw-r--r--devices/src/virtio/virtio_pci_device.rs5
2 files changed, 5 insertions, 1 deletions
diff --git a/bin/clippy b/bin/clippy
index a7a70c1..c778f0f 100755
--- a/bin/clippy
+++ b/bin/clippy
@@ -39,7 +39,6 @@ SUPPRESS=(
     while_let_loop
 
     # To be resolved or suppressed locally.
-    absurd_extreme_comparisons
     cast_ptr_alignment
     if_same_then_else
     ptr_arg
diff --git a/devices/src/virtio/virtio_pci_device.rs b/devices/src/virtio/virtio_pci_device.rs
index 7c5b0d8..c07c96d 100644
--- a/devices/src/virtio/virtio_pci_device.rs
+++ b/devices/src/virtio/virtio_pci_device.rs
@@ -402,6 +402,10 @@ impl PciDevice for VirtioPciDevice {
         &mut self.config_regs
     }
 
+    // Clippy: the value of COMMON_CONFIG_BAR_OFFSET happens to be zero so the
+    // expression `COMMON_CONFIG_BAR_OFFSET <= o` is always true, but this code
+    // is written such that the value of the const may be changed independently.
+    #[allow(clippy::absurd_extreme_comparisons)]
     fn read_bar(&mut self, addr: u64, data: &mut [u8]) {
         // The driver is only allowed to do aligned, properly sized access.
         let bar0 = self.config_regs.get_bar_addr(self.settings_bar as usize) as u64;
@@ -437,6 +441,7 @@ impl PciDevice for VirtioPciDevice {
         }
     }
 
+    #[allow(clippy::absurd_extreme_comparisons)]
     fn write_bar(&mut self, addr: u64, data: &[u8]) {
         let bar0 = self.config_regs.get_bar_addr(self.settings_bar as usize) as u64;
         let offset = addr - bar0;