Skip to content

Commit 2caeb65

Browse files
committed
Uses less verbose syntax for object creation
1 parent 6d171f9 commit 2caeb65

4 files changed

Lines changed: 10 additions & 10 deletions

File tree

rust/src/array.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ struct RawPtrBox<T> {
106106

107107
impl<T> RawPtrBox<T> {
108108
fn new(inner: *const T) -> Self {
109-
Self { inner: inner }
109+
Self { inner }
110110
}
111111

112112
fn get(&self) -> *const T {
@@ -244,7 +244,7 @@ impl<T: ArrowPrimitiveType> From<ArrayDataRef> for PrimitiveArray<T> {
244244
let raw_values = data.buffers()[0].raw_data();
245245
assert!(memory::is_aligned::<u8>(raw_values, mem::align_of::<T>()));
246246
Self {
247-
data: data,
247+
data,
248248
raw_values: RawPtrBox::new(raw_values as *const T),
249249
}
250250
}
@@ -336,7 +336,7 @@ impl From<ArrayDataRef> for ListArray {
336336
}
337337
Self {
338338
data: data.clone(),
339-
values: values,
339+
values,
340340
value_offsets: RawPtrBox::new(value_offsets),
341341
}
342342
}
@@ -479,8 +479,8 @@ impl From<ArrayDataRef> for StructArray {
479479
boxed_fields.push(make_array(cd.clone()));
480480
}
481481
Self {
482-
data: data,
483-
boxed_fields: boxed_fields,
482+
data,
483+
boxed_fields,
484484
}
485485
}
486486
}

rust/src/array_data.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ pub struct ArrayDataBuilder {
156156
impl ArrayDataBuilder {
157157
pub fn new(data_type: DataType) -> Self {
158158
Self {
159-
data_type: data_type,
159+
data_type,
160160
len: 0,
161161
null_count: UNKNOWN_NULL_COUNT,
162162
null_bit_buffer: None,

rust/src/buffer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ impl Buffer {
6060
/// Creates a buffer from an existing memory region (must already be byte-aligned)
6161
pub fn from_raw_parts(ptr: *const u8, len: usize) -> Self {
6262
assert!(memory::is_aligned(ptr, 64));
63-
let buf_data = BufferData { ptr: ptr, len: len };
63+
let buf_data = BufferData { ptr, len };
6464
Buffer {
6565
data: Arc::new(buf_data),
6666
offset: 0,

rust/src/datatypes.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -193,8 +193,8 @@ impl Field {
193193
pub fn new(name: &str, data_type: DataType, nullable: bool) -> Self {
194194
Field {
195195
name: name.to_string(),
196-
data_type: data_type,
197-
nullable: nullable,
196+
data_type,
197+
nullable,
198198
}
199199
}
200200

@@ -284,7 +284,7 @@ impl Schema {
284284
}
285285

286286
pub fn new(columns: Vec<Field>) -> Self {
287-
Schema { columns: columns }
287+
Schema { columns }
288288
}
289289

290290
pub fn columns(&self) -> &Vec<Field> {

0 commit comments

Comments
 (0)