From 92b7cb90d6b15d55b4049d8d779d7a433bc10bd5 Mon Sep 17 00:00:00 2001 From: Raphael Taylor-Davies Date: Fri, 28 Jan 2022 23:58:07 +0000 Subject: [PATCH] Fix lints --- arrow/src/util/pretty.rs | 10 +++++----- parquet/src/arrow/async_reader.rs | 8 +++----- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/arrow/src/util/pretty.rs b/arrow/src/util/pretty.rs index 91343ec0f161..4b67f3d376ed 100644 --- a/arrow/src/util/pretty.rs +++ b/arrow/src/util/pretty.rs @@ -74,7 +74,7 @@ fn create_table(results: &[RecordBatch]) -> Result { let mut cells = Vec::new(); for col in 0..batch.num_columns() { let column = batch.column(col); - cells.push(Cell::new(&array_value_to_string(&column, row)?)); + cells.push(Cell::new(&array_value_to_string(column, row)?)); } table.add_row(cells); } @@ -96,7 +96,7 @@ fn create_column(field: &str, columns: &[ArrayRef]) -> Result
{ for col in columns { for row in 0..col.len() { - let cells = vec![Cell::new(&array_value_to_string(&col, row)?)]; + let cells = vec![Cell::new(&array_value_to_string(col, row)?)]; table.add_row(cells); } } @@ -320,7 +320,7 @@ mod tests { let mut builder = FixedSizeBinaryBuilder::new(3, 3); builder.append_value(&[1, 2, 3]).unwrap(); - builder.append_null(); + builder.append_null().unwrap(); builder.append_value(&[7, 8, 9]).unwrap(); let array = Arc::new(builder.finish()); @@ -677,7 +677,7 @@ mod tests { )?; let mut buf = String::new(); - write!(&mut buf, "{}", pretty_format_batches(&[batch])?.to_string()).unwrap(); + write!(&mut buf, "{}", pretty_format_batches(&[batch])?).unwrap(); let s = vec![ "+---+-----+", @@ -689,7 +689,7 @@ mod tests { "| d | 100 |", "+---+-----+", ]; - let expected = String::from(s.join("\n")); + let expected = s.join("\n"); assert_eq!(expected, buf); Ok(()) diff --git a/parquet/src/arrow/async_reader.rs b/parquet/src/arrow/async_reader.rs index c9040bf12b93..4f0a4cb51dd9 100644 --- a/parquet/src/arrow/async_reader.rs +++ b/parquet/src/arrow/async_reader.rs @@ -112,7 +112,7 @@ impl ParquetRecordBatchStreamBuilder { /// Only read data from the provided column indexes pub fn with_projection(self, projection: Vec) -> Self { Self { - projection: Some(projection.into()), + projection: Some(projection), ..self } } @@ -339,7 +339,7 @@ async fn read_footer( let mut buf = [0_u8; 8]; input.read_exact(&mut buf).await?; - if &buf[4..] != PARQUET_MAGIC { + if buf[4..] != PARQUET_MAGIC { return Err(general_err!("Invalid Parquet file. Corrupt footer")); } @@ -455,9 +455,7 @@ mod tests { .with_projection(vec![1, 2, 6]) .with_batch_size(3); - let stream = builder - .build() - .unwrap(); + let stream = builder.build().unwrap(); let results = stream.try_collect::>().await.unwrap(); assert_eq!(results.len(), 3);