From a154e45cce79b0c2264c1e1cd37a3d1bf5bc6154 Mon Sep 17 00:00:00 2001 From: KyleMiles Date: Thu, 5 Jan 2023 17:29:14 -0500 Subject: Rust API: Lots and lots of clippy changes --- rust/src/binaryview.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'rust/src/binaryview.rs') diff --git a/rust/src/binaryview.rs b/rust/src/binaryview.rs index ad9a0fc9..2c9c5cc2 100644 --- a/rust/src/binaryview.rs +++ b/rust/src/binaryview.rs @@ -54,16 +54,20 @@ use crate::string::*; pub type Result = result::Result; +#[allow(clippy::len_without_is_empty)] pub trait BinaryViewBase: AsRef { fn read(&self, _buf: &mut [u8], _offset: u64) -> usize { 0 } + fn write(&self, _offset: u64, _data: &[u8]) -> usize { 0 } + fn insert(&self, _offset: u64, _data: &[u8]) -> usize { 0 } + fn remove(&self, _offset: u64, _len: usize) -> usize { 0 } @@ -110,6 +114,7 @@ pub trait BinaryViewBase: AsRef { fn start(&self) -> u64 { 0 } + fn len(&self) -> usize { 0 } @@ -117,6 +122,7 @@ pub trait BinaryViewBase: AsRef { fn executable(&self) -> bool { true } + fn relocatable(&self) -> bool { true } @@ -890,7 +896,7 @@ pub trait BinaryViewExt: BinaryViewBase { ) -> Array { let mut result = unsafe { Array::new(std::ptr::null_mut(), 0, ()) }; - while result.len() == 0 { + while result.is_empty() { result = pos.lines(); if !pos.next() { return result; @@ -913,7 +919,7 @@ pub trait BinaryViewExt: BinaryViewBase { pos: &mut LinearViewCursor, ) -> Array { let mut result = unsafe { Array::new(std::ptr::null_mut(), 0, ()) }; - while result.len() == 0 { + while result.is_empty() { if !pos.previous() { return result; } -- cgit v1.3.1