You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by dh...@apache.org on 2022/10/12 15:36:00 UTC
[arrow-rs] branch master updated: Fix some clippy errors (#2862)
This is an automated email from the ASF dual-hosted git repository.
dheres pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow-rs.git
The following commit(s) were added to refs/heads/master by this push:
new 3bb7f3882 Fix some clippy errors (#2862)
3bb7f3882 is described below
commit 3bb7f3882c4866087b6ec43a31f0b6430f5103d1
Author: Liang-Chi Hsieh <vi...@gmail.com>
AuthorDate: Wed Oct 12 08:35:54 2022 -0700
Fix some clippy errors (#2862)
---
arrow-array/src/array/primitive_array.rs | 2 +-
arrow-buffer/src/buffer/mutable.rs | 2 +-
arrow-flight/src/lib.rs | 3 +++
arrow/src/csv/writer.rs | 1 +
arrow/src/lib.rs | 2 +-
arrow/src/pyarrow.rs | 2 +-
arrow/src/util/test_util.rs | 4 ++--
integration-testing/src/util/mod.rs | 2 +-
parquet/src/arrow/arrow_writer/levels.rs | 2 +-
parquet/src/encodings/rle.rs | 14 +++++++-------
parquet/src/format.rs | 4 ++--
parquet_derive/src/parquet_field.rs | 12 ++++++------
12 files changed, 27 insertions(+), 23 deletions(-)
diff --git a/arrow-array/src/array/primitive_array.rs b/arrow-array/src/array/primitive_array.rs
index e362f0d7e..928135463 100644
--- a/arrow-array/src/array/primitive_array.rs
+++ b/arrow-array/src/array/primitive_array.rs
@@ -786,7 +786,7 @@ impl<T: ArrowTimestampType> PrimitiveArray<T> {
}
impl<T: ArrowTimestampType> PrimitiveArray<T> {
- /// Construct a timestamp array from a vec of Option<i64> values and an optional timezone
+ /// Construct a timestamp array from a vec of `Option<i64>` values and an optional timezone
pub fn from_opt_vec(data: Vec<Option<i64>>, timezone: Option<String>) -> Self {
// TODO: duplicated from def_numeric_from_vec! macro, it looks possible to convert to generic
let data_len = data.len();
diff --git a/arrow-buffer/src/buffer/mutable.rs b/arrow-buffer/src/buffer/mutable.rs
index 80644b63d..bd139466a 100644
--- a/arrow-buffer/src/buffer/mutable.rs
+++ b/arrow-buffer/src/buffer/mutable.rs
@@ -365,7 +365,7 @@ impl MutableBuffer {
/// Extends the buffer with a new item, without checking for sufficient capacity
/// # Safety
- /// Caller must ensure that the capacity()-len()>=size_of<T>()
+ /// Caller must ensure that the capacity()-len()>=`size_of<T>`()
#[inline]
pub unsafe fn push_unchecked<T: ToByteSlice>(&mut self, item: T) {
let additional = std::mem::size_of::<T>();
diff --git a/arrow-flight/src/lib.rs b/arrow-flight/src/lib.rs
index 54f4d24b6..054981707 100644
--- a/arrow-flight/src/lib.rs
+++ b/arrow-flight/src/lib.rs
@@ -15,6 +15,8 @@
// specific language governing permissions and limitations
// under the License.
+#![allow(rustdoc::invalid_html_tags)]
+
use arrow::datatypes::Schema;
use arrow::error::{ArrowError, Result as ArrowResult};
use arrow::ipc::{convert, writer, writer::EncodedData, writer::IpcWriteOptions};
@@ -27,6 +29,7 @@ use std::{
};
#[allow(clippy::derive_partial_eq_without_eq)]
+
mod gen {
include!("arrow.flight.protocol.rs");
}
diff --git a/arrow/src/csv/writer.rs b/arrow/src/csv/writer.rs
index 1b377c38b..eb7a8fd5b 100644
--- a/arrow/src/csv/writer.rs
+++ b/arrow/src/csv/writer.rs
@@ -103,6 +103,7 @@ pub struct Writer<W: Write> {
/// The datetime format for datetime arrays
datetime_format: String,
/// The timestamp format for timestamp arrays
+ #[allow(dead_code)]
timestamp_format: String,
/// The timestamp format for timestamp (with timezone) arrays
#[allow(dead_code)]
diff --git a/arrow/src/lib.rs b/arrow/src/lib.rs
index 8967efce5..324803cb1 100644
--- a/arrow/src/lib.rs
+++ b/arrow/src/lib.rs
@@ -248,7 +248,7 @@
#![deny(clippy::redundant_clone)]
#![warn(missing_debug_implementations)]
-
+#![allow(rustdoc::invalid_html_tags)]
pub use arrow_array::{downcast_dictionary_array, downcast_primitive_array};
pub use arrow_buffer::{alloc, buffer};
diff --git a/arrow/src/pyarrow.rs b/arrow/src/pyarrow.rs
index d8d5eee53..7c365a434 100644
--- a/arrow/src/pyarrow.rs
+++ b/arrow/src/pyarrow.rs
@@ -219,7 +219,7 @@ impl PyArrowConvert for ArrowArrayStreamReader {
unsafe { ArrowArrayStreamReader::from_raw(stream_ptr).unwrap() };
unsafe {
- Box::from_raw(stream_ptr);
+ drop(Box::from_raw(stream_ptr));
}
Ok(stream_reader)
diff --git a/arrow/src/util/test_util.rs b/arrow/src/util/test_util.rs
index cae148a53..836bda6f9 100644
--- a/arrow/src/util/test_util.rs
+++ b/arrow/src/util/test_util.rs
@@ -167,8 +167,8 @@ pub struct BadIterator<T> {
}
impl<T> BadIterator<T> {
- /// Create a new iterator for <limit> items, but that reports to
- /// produce <claimed> items. Must provide at least 1 item.
+ /// Create a new iterator for `<limit>` items, but that reports to
+ /// produce `<claimed>` items. Must provide at least 1 item.
pub fn new(limit: usize, claimed: usize, items: Vec<T>) -> Self {
assert!(!items.is_empty());
Self {
diff --git a/integration-testing/src/util/mod.rs b/integration-testing/src/util/mod.rs
index f9ddc0e6f..c0eb80a35 100644
--- a/integration-testing/src/util/mod.rs
+++ b/integration-testing/src/util/mod.rs
@@ -978,7 +978,7 @@ pub fn dictionary_array_from_json(
}
}
-/// A helper to create a null buffer from a Vec<bool>
+/// A helper to create a null buffer from a `Vec<bool>`
fn create_null_buf(json_col: &ArrowJsonColumn) -> Buffer {
let num_bytes = bit_util::ceil(json_col.count, 8);
let mut null_buf = MutableBuffer::new(num_bytes).with_bitset(num_bytes, false);
diff --git a/parquet/src/arrow/arrow_writer/levels.rs b/parquet/src/arrow/arrow_writer/levels.rs
index f5e26a728..5736f05fd 100644
--- a/parquet/src/arrow/arrow_writer/levels.rs
+++ b/parquet/src/arrow/arrow_writer/levels.rs
@@ -213,7 +213,7 @@ impl LevelInfoBuilder {
/// Write `range` elements from ListArray `array`
///
- /// Note: MapArrays are ListArray<i32> under the hood and so are dispatched to this method
+ /// Note: MapArrays are `ListArray<i32>` under the hood and so are dispatched to this method
fn write_list<O: OffsetSizeTrait>(
&mut self,
offsets: &[O],
diff --git a/parquet/src/encodings/rle.rs b/parquet/src/encodings/rle.rs
index 39a0aa4d0..93dd4ab56 100644
--- a/parquet/src/encodings/rle.rs
+++ b/parquet/src/encodings/rle.rs
@@ -27,17 +27,17 @@ use crate::util::{
/// The grammar for this encoding looks like the following (copied verbatim
/// from <https://github.com/Parquet/parquet-format/blob/master/Encodings.md>):
///
-/// rle-bit-packed-hybrid: <length> <encoded-data>
-/// length := length of the <encoded-data> in bytes stored as 4 bytes little endian
-/// encoded-data := <run>*
-/// run := <bit-packed-run> | <rle-run>
-/// bit-packed-run := <bit-packed-header> <bit-packed-values>
-/// bit-packed-header := varint-encode(<bit-pack-count> << 1 | 1)
+/// rle-bit-packed-hybrid: `<length>` `<encoded-data>`
+/// length := length of the `<encoded-data>` in bytes stored as 4 bytes little endian
+/// encoded-data := `<run>`*
+/// run := `<bit-packed-run>` | `<rle-run>`
+/// bit-packed-run := `<bit-packed-header>` `<bit-packed-values>`
+/// bit-packed-header := varint-encode(`<bit-pack-count>` << 1 | 1)
/// we always bit-pack a multiple of 8 values at a time, so we only store the number of
/// values / 8
/// bit-pack-count := (number of values in this run) / 8
/// bit-packed-values := *see 1 below*
-/// rle-run := <rle-header> <repeated-value>
+/// rle-run := `<rle-header>` `<repeated-value>`
/// rle-header := varint-encode( (number of times repeated) << 1)
/// repeated-value := value that is repeated, using a fixed-width of
/// round-up-to-next-byte(bit-width)
diff --git a/parquet/src/format.rs b/parquet/src/format.rs
index 00a89a4c7..6fb2e32eb 100644
--- a/parquet/src/format.rs
+++ b/parquet/src/format.rs
@@ -4452,7 +4452,7 @@ impl OffsetIndex {
//
/// Description for ColumnIndex.
-/// Each <array-field>\[i\] refers to the page at OffsetIndex.page_locations\[i\]
+/// Each `<array-field>`\[i\] refers to the page at OffsetIndex.page_locations\[i\]
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct ColumnIndex {
/// A list of Boolean values to determine the validity of the corresponding
@@ -4905,7 +4905,7 @@ pub struct FileMetaData {
/// Optional key/value metadata *
pub key_value_metadata: Option<Vec<KeyValue>>,
/// String for application that wrote this file. This should be in the format
- /// <Application> version <App Version> (build <App Build Hash>).
+ /// `<Application>` version `<App Version>` (build `<App Build Hash>`).
/// e.g. impala version 1.0 (build 6cf94d29b2b7115df4de2c06e2ab4326d721eb55)
///
pub created_by: Option<String>,
diff --git a/parquet_derive/src/parquet_field.rs b/parquet_derive/src/parquet_field.rs
index 0642e2332..82e3b5112 100644
--- a/parquet_derive/src/parquet_field.rs
+++ b/parquet_derive/src/parquet_field.rs
@@ -68,7 +68,7 @@ impl Field {
///
/// struct Record {
/// a_bool: bool,
- /// maybe_a_bool: Option<bool>
+ /// maybe_a_bool: `Option<bool>`
/// }
///
/// but not
@@ -355,9 +355,9 @@ impl Type {
/// Helper to simplify a nested field definition to its leaf type
///
/// Ex:
- /// Option<&String> => Type::TypePath(String)
- /// &Option<i32> => Type::TypePath(i32)
- /// Vec<Vec<u8>> => Type::Vec(u8)
+ /// `Option<&String>` => Type::TypePath(String)
+ /// `&Option<i32>` => Type::TypePath(i32)
+ /// `Vec<Vec<u8>>` => Type::Vec(u8)
///
/// Useful in determining the physical type of a field and the
/// definition levels.
@@ -404,7 +404,7 @@ impl Type {
///
/// Ex:
/// std::string::String => String
- /// Vec<u8> => Vec<u8>
+ /// `Vec<u8>` => `Vec<u8>`
/// chrono::NaiveDateTime => NaiveDateTime
///
/// Does run the risk of mis-identifying a type if import
@@ -427,7 +427,7 @@ impl Type {
///
/// Ex:
/// [u8; 10] => FIXED_LEN_BYTE_ARRAY
- /// Vec<u8> => BYTE_ARRAY
+ /// `Vec<u8>` => BYTE_ARRAY
/// String => BYTE_ARRAY
/// i32 => INT32
fn physical_type(&self) -> parquet::basic::Type {