Apache DataFusion SQL Query Engine
Fix broken build on master (remove duplicate Drop impl for Buffer) (#1828)
Andy Groveee77228e2936
diff --git a/rust/src/array.rs b/rust/src/array.rsindex 6f377cba03..960f33e160 100644--- a/rust/src/array.rs+++ b/rust/src/array.rs@@ -23,8 +23,8 @@ use std::string::String;use super::bitmap::Bitmap;use super::buffer::Buffer;-use super::list::List;use super::error::*;+use super::list::List;pub enum ArrayData {Boolean(Buffer<bool>),@@ -43,7 +43,7 @@ pub enum ArrayData {}macro_rules! arraydata_from_primitive {- ($DT: ty, $AT: ident) => {+ ($DT:ty, $AT:ident) => {impl From<Vec<$DT>> for ArrayData {fn from(v: Vec<$DT>) -> Self {ArrayData::$AT(Buffer::from(v))@@ -107,7 +107,7 @@ trait ArrayOps<T> {}macro_rules! array_ops {- ($DT: ty, $AT: ident) => {+ ($DT:ty, $AT:ident) => {impl ArrayOps<$DT> for Array {fn get(&self, i: usize) -> Result<$DT, Error> {match self.data() {@@ -160,7 +160,7 @@ array_ops!(i32, Int32);array_ops!(i64, Int64);macro_rules! array_from_primitive {- ($DT: ty) => {+ ($DT:ty) => {impl From<Vec<$DT>> for Array {fn from(v: Vec<$DT>) -> Self {Array {@@ -186,7 +186,7 @@ array_from_primitive!(i32);array_from_primitive!(i64);macro_rules! array_from_optional_primitive {- ($DT: ty, $DEFAULT: expr) => {+ ($DT:ty, $DEFAULT:expr) => {impl From<Vec<Option<$DT>>> for Array {fn from(v: Vec<Option<$DT>>) -> Self {let mut null_count = 0;@@ -253,8 +253,8 @@ impl From<Vec<Rc<Array>>> for Array {#[cfg(test)]mod tests {- use super::*;use super::super::datatypes::*;+ use super::*;#[test]fn test_utf8_offsets() {diff --git a/rust/src/buffer.rs b/rust/src/buffer.rsindex 758d5c1628..72b2a27d89 100644--- a/rust/src/buffer.rs+++ b/rust/src/buffer.rs@@ -15,9 +15,9 @@// specific language governing permissions and limitations// under the License.+use libc;use std::mem;use std::slice;-use libc;use super::memory::*;@@ -58,10 +58,9 @@ impl<T> Buffer<T> {BufferIterator {data: self.data,len: self.len,- index: 0+ index: 0,}}-}impl<T> Drop for Buffer<T> {@@ -73,30 +72,27 @@ impl<T> Drop for Buffer<T> {pub struct BufferIterator<T> {data: *const T,len: i32,- index: isize+ index: isize,}-impl<T> Iterator for BufferIterator<T> where T: Copy {+impl<T> Iterator for BufferIterator<T>+where+ T: Copy,+{type Item = T;fn next(&mut self) -> Option<Self::Item> {if self.index < self.len as isize {self.index += 1;- Some(unsafe { *self.data.offset(self.index-1) })+ Some(unsafe { *self.data.offset(self.index - 1) })} else {None}}}-impl<T> Drop for Buffer<T> {- fn drop(&mut self) {- mem::drop(self.data)- }-}-macro_rules! array_from_primitive {- ($DT: ty) => {+ ($DT:ty) => {impl From<Vec<$DT>> for Buffer<$DT> {fn from(v: Vec<$DT>) -> Self {// allocate aligned memory buffer@@ -146,7 +142,7 @@ mod tests {fn test_iterator_i32() {let b: Buffer<i32> = Buffer::from(vec![1, 2, 3, 4, 5]);let it = b.iter();- let v : Vec<i32> = it.map(|n| n+1).collect();- assert_eq!(vec![2,3,4,5,6], v);+ let v: Vec<i32> = it.map(|n| n + 1).collect();+ assert_eq!(vec![2, 3, 4, 5, 6], v);}}diff --git a/rust/src/lib.rs b/rust/src/lib.rsindex cd1154d160..8eeb34023e 100644--- a/rust/src/lib.rs+++ b/rust/src/lib.rs@@ -22,6 +22,6 @@ pub mod array;pub mod bitmap;pub mod buffer;pub mod datatypes;-pub mod list;pub mod error;+pub mod list;pub mod memory;diff --git a/rust/src/memory.rs b/rust/src/memory.rsindex db527ab34a..2e5aaf0f95 100644--- a/rust/src/memory.rs+++ b/rust/src/memory.rs@@ -15,8 +15,8 @@// specific language governing permissions and limitations// under the License.-use std::mem;use libc;+use std::mem;use super::error::Error;@@ -39,12 +39,11 @@ mod tests {#[test]fn test_allocate() {- for _ in 0 .. 10 {+ for _ in 0..10 {let p = allocate_aligned(1024).unwrap();// make sure this is 64-byte alignedassert_eq!(0, (p as usize) % 64);}-}}