Repository: jorgecarleitao/arrow2 (rust)

Issue:
Make IpcWriteOptions easier to find.
Expose `arrow2::io::ipc::write::IpcWriteOptions` instead of `arrow2::io::ipc::write::common::IpcWriteOptions`, for easier access and logical meaning.

Pull request:
Exposed IPCWriteOptions in io::ipc::write.
Closes #120 

Also cleans up some code.

Patch:
diff --git a/src/compute/cast/mod.rs b/src/compute/cast/mod.rs
index 2a99c899c3..9d09e6bc75 100644
--- a/src/compute/cast/mod.rs
+++ b/src/compute/cast/mod.rs
@@ -53,7 +53,7 @@ impl Default for CastOptions {
 
 impl CastOptions {
     fn with_wrapped(&self, v: bool) -> Self {
-        let mut option = self.clone();
+        let mut option = *self;
         option.wrapped = v;
         option
     }
@@ -1234,6 +1234,7 @@ mod tests {
         assert_eq!(expected, result.as_ref());
     }
 
+    #[test]
     fn list_to_list() {
         let data = vec![
             Some(vec![Some(1i32), Some(2), Some(3)]),
diff --git a/src/compute/cast/primitive_to.rs b/src/compute/cast/primitive_to.rs
index 862af498e4..6b6bb90f3f 100644
--- a/src/compute/cast/primitive_to.rs
+++ b/src/compute/cast/primitive_to.rs
@@ -89,11 +89,7 @@ where
     I: NativeType + num::traits::AsPrimitive<O>,
     O: NativeType,
 {
-    unary(
-        from,
-        |x| num::traits::AsPrimitive::<O>::as_(x),
-        to_type.clone(),
-    )
+    unary(from, num::traits::AsPrimitive::<O>::as_, to_type.clone())
 }
 
 /// Cast [`PrimitiveArray`] to a [`PrimitiveArray`] of the same physical type.
diff --git a/src/io/ipc/write/mod.rs b/src/io/ipc/write/mod.rs
index e2be9700e0..7bdf9089fe 100644
--- a/src/io/ipc/write/mod.rs
+++ b/src/io/ipc/write/mod.rs
@@ -22,6 +22,7 @@ mod stream;
 mod writer;
 
 pub use super::gen::Schema::MetadataVersion;
+pub use common::IpcWriteOptions;
 pub use schema::schema_to_bytes;
 pub use serialize::{write, write_dictionary};
 pub use stream::StreamWriter;


Test patch:
diff --git a/integration-testing/src/flight_client_scenarios/integration_test.rs b/integration-testing/src/flight_client_scenarios/integration_test.rs
index 9c4179e7fd..7cb128cdf6 100644
--- a/integration-testing/src/flight_client_scenarios/integration_test.rs
+++ b/integration-testing/src/flight_client_scenarios/integration_test.rs
@@ -76,7 +76,7 @@ async fn upload_data(
 ) -> Result {
     let (mut upload_tx, upload_rx) = mpsc::channel(10);
 
-    let options = write::common::IpcWriteOptions::default();
+    let options = write::IpcWriteOptions::default();
     let mut schema_flight_data =
         arrow_flight::utils::flight_data_from_arrow_schema(&schema, &options);
     schema_flight_data.flight_descriptor = Some(descriptor.clone());
@@ -128,7 +128,7 @@ async fn send_batch(
     upload_tx: &mut mpsc::Sender<FlightData>,
     metadata: &[u8],
     batch: &RecordBatch,
-    options: &write::common::IpcWriteOptions,
+    options: &write::IpcWriteOptions,
 ) -> Result {
     let (dictionary_flight_data, mut batch_flight_data) =
         arrow_flight::utils::flight_data_from_arrow_batch(batch, &options);
diff --git a/integration-testing/src/flight_server_scenarios/integration_test.rs b/integration-testing/src/flight_server_scenarios/integration_test.rs
index b10df3dc9b..118564cf8a 100644
--- a/integration-testing/src/flight_server_scenarios/integration_test.rs
+++ b/integration-testing/src/flight_server_scenarios/integration_test.rs
@@ -106,7 +106,7 @@ impl FlightService for FlightServiceImpl {
             .get(&key)
             .ok_or_else(|| Status::not_found(format!("Could not find flight. {}", key)))?;
 
-        let options = ipc::write::common::IpcWriteOptions::default();
+        let options = ipc::write::IpcWriteOptions::default();
 
         let schema = std::iter::once({
             Ok(arrow_flight::utils::flight_data_from_arrow_schema(
@@ -174,7 +174,7 @@ impl FlightService for FlightServiceImpl {
 
                 let total_records: usize = flight.chunks.iter().map(|chunk| chunk.num_rows()).sum();
 
-                let options = ipc::write::common::IpcWriteOptions::default();
+                let options = ipc::write::IpcWriteOptions::default();
                 let schema =
                     arrow_flight::utils::ipc_message_from_arrow_schema(&flight.schema, &options)
                         .expect(