You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by we...@apache.org on 2018/08/06 19:40:20 UTC
[arrow] 05/15: ARROW-2978: [Rust] Change argument to rust fmt to
fix build
This is an automated email from the ASF dual-hosted git repository.
wesm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow.git
commit 1b2a42e563c6b6f5e8e72144303e0dfcb168300f
Author: Andy Grove <an...@gmail.com>
AuthorDate: Sun Aug 5 16:01:31 2018 -0400
ARROW-2978: [Rust] Change argument to rust fmt to fix build
Work in progress... trying to fix the build.
Author: Andy Grove <an...@gmail.com>
Closes #2371 from andygrove/fix_rust_ci_failure and squashes the following commits:
94c12773 <Andy Grove> Update code formatting to keep latest version of rust fmt happy
1b3e72d9 <Andy Grove> Change argument to rust fmt to fix build
---
ci/travis_script_rust.sh | 2 +-
rust/src/array.rs | 7 ++-----
rust/src/buffer.rs | 15 ++++++++++-----
rust/src/datatypes.rs | 13 ++++++++-----
4 files changed, 21 insertions(+), 16 deletions(-)
diff --git a/ci/travis_script_rust.sh b/ci/travis_script_rust.sh
index ff12483..f85820f 100755
--- a/ci/travis_script_rust.sh
+++ b/ci/travis_script_rust.sh
@@ -25,7 +25,7 @@ pushd $RUST_DIR
# raises on any formatting errors
rustup component add rustfmt-preview
-cargo fmt --all -- --write-mode=diff
+cargo fmt --all -- --check
# raises on any warnings
cargo rustc -- -D warnings
diff --git a/rust/src/array.rs b/rust/src/array.rs
index e418518..1c4322c 100644
--- a/rust/src/array.rs
+++ b/rust/src/array.rs
@@ -19,9 +19,9 @@
use std::any::Any;
use std::convert::From;
use std::ops::Add;
-use std::sync::Arc;
use std::str;
use std::string::String;
+use std::sync::Arc;
use super::bitmap::Bitmap;
use super::buffer::*;
@@ -453,12 +453,9 @@ mod tests {
fn test_access_array_concurrently() {
let a = PrimitiveArray::from(Buffer::from(vec![5, 6, 7, 8, 9]));
- let ret = thread::spawn(move || {
- a.iter().collect::<Vec<i32>>()
- }).join();
+ let ret = thread::spawn(move || a.iter().collect::<Vec<i32>>()).join();
assert!(ret.is_ok());
assert_eq!(vec![5, 6, 7, 8, 9], ret.ok().unwrap());
}
}
-
diff --git a/rust/src/buffer.rs b/rust/src/buffer.rs
index 0fdc2c5..bdc3601 100644
--- a/rust/src/buffer.rs
+++ b/rust/src/buffer.rs
@@ -190,7 +190,8 @@ mod tests {
fn test_buffer_eq() {
let a = Buffer::from(vec![1, 2, 3, 4, 5]);
let b = Buffer::from(vec![5, 4, 3, 2, 1]);
- let c = a.iter()
+ let c = a
+ .iter()
.zip(b.iter())
.map(|(a, b)| a == b)
.collect::<Vec<bool>>();
@@ -201,7 +202,8 @@ mod tests {
fn test_buffer_lt() {
let a = Buffer::from(vec![1, 2, 3, 4, 5]);
let b = Buffer::from(vec![5, 4, 3, 2, 1]);
- let c = a.iter()
+ let c = a
+ .iter()
.zip(b.iter())
.map(|(a, b)| a < b)
.collect::<Vec<bool>>();
@@ -212,7 +214,8 @@ mod tests {
fn test_buffer_gt() {
let a = Buffer::from(vec![1, 2, 3, 4, 5]);
let b = Buffer::from(vec![5, 4, 3, 2, 1]);
- let c = a.iter()
+ let c = a
+ .iter()
.zip(b.iter())
.map(|(a, b)| a > b)
.collect::<Vec<bool>>();
@@ -223,7 +226,8 @@ mod tests {
fn test_buffer_add() {
let a = Buffer::from(vec![1, 2, 3, 4, 5]);
let b = Buffer::from(vec![5, 4, 3, 2, 1]);
- let c = a.iter()
+ let c = a
+ .iter()
.zip(b.iter())
.map(|(a, b)| a + b)
.collect::<Vec<i32>>();
@@ -234,7 +238,8 @@ mod tests {
fn test_buffer_multiply() {
let a = Buffer::from(vec![1, 2, 3, 4, 5]);
let b = Buffer::from(vec![5, 4, 3, 2, 1]);
- let c = a.iter()
+ let c = a
+ .iter()
.zip(b.iter())
.map(|(a, b)| a * b)
.collect::<Vec<i32>>();
diff --git a/rust/src/datatypes.rs b/rust/src/datatypes.rs
index d4849da..2adec0b 100644
--- a/rust/src/datatypes.rs
+++ b/rust/src/datatypes.rs
@@ -278,11 +278,14 @@ impl Schema {
impl fmt::Display for Schema {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
- f.write_str(&self.columns
- .iter()
- .map(|c| c.to_string())
- .collect::<Vec<String>>()
- .join(", "))
+ f.write_str(
+ &self
+ .columns
+ .iter()
+ .map(|c| c.to_string())
+ .collect::<Vec<String>>()
+ .join(", "),
+ )
}
}