You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by uw...@apache.org on 2018/04/03 09:20:32 UTC

[arrow] branch master updated: Fix broken build on master (remove duplicate Drop impl for Buffer) (#1828)

This is an automated email from the ASF dual-hosted git repository.

uwe pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow.git


The following commit(s) were added to refs/heads/master by this push:
     new b0f376a  Fix broken build on master (remove duplicate Drop impl for Buffer) (#1828)
b0f376a is described below

commit b0f376a82e0f3c5dd542984e0a3774d22fb9543a
Author: Andy Grove <an...@users.noreply.github.com>
AuthorDate: Tue Apr 3 03:20:30 2018 -0600

    Fix broken build on master (remove duplicate Drop impl for Buffer) (#1828)
    
    * remove duplicate Drop impl for Buffer
    
    * run rustfmt
---
 rust/src/array.rs  | 12 ++++++------
 rust/src/buffer.rs | 26 +++++++++++---------------
 rust/src/lib.rs    |  2 +-
 rust/src/memory.rs |  5 ++---
 4 files changed, 20 insertions(+), 25 deletions(-)

diff --git a/rust/src/array.rs b/rust/src/array.rs
index 6f377cb..960f33e 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.rs
index 758d5c1..72b2a27 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.rs
index cd1154d..8eeb340 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.rs
index db527ab..2e5aaf0 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 aligned
             assert_eq!(0, (p as usize) % 64);
         }
-
     }
 
 }

-- 
To stop receiving notification emails like this one, please contact
uwe@apache.org.