Skip to content

Commit

Permalink
Fix some clippy errors (#2862)
Browse files Browse the repository at this point in the history
  • Loading branch information
viirya committed Oct 12, 2022
1 parent 0268bba commit 3bb7f38
Show file tree
Hide file tree
Showing 12 changed files with 27 additions and 23 deletions.
2 changes: 1 addition & 1 deletion arrow-array/src/array/primitive_array.rs
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion arrow-buffer/src/buffer/mutable.rs
Expand Up @@ -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>();
Expand Down
3 changes: 3 additions & 0 deletions arrow-flight/src/lib.rs
Expand Up @@ -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};
Expand All @@ -27,6 +29,7 @@ use std::{
};

#[allow(clippy::derive_partial_eq_without_eq)]

mod gen {
include!("arrow.flight.protocol.rs");
}
Expand Down
1 change: 1 addition & 0 deletions arrow/src/csv/writer.rs
Expand Up @@ -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)]
Expand Down
2 changes: 1 addition & 1 deletion arrow/src/lib.rs
Expand Up @@ -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};
Expand Down
2 changes: 1 addition & 1 deletion arrow/src/pyarrow.rs
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions arrow/src/util/test_util.rs
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion integration-testing/src/util/mod.rs
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion parquet/src/arrow/arrow_writer/levels.rs
Expand Up @@ -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],
Expand Down
14 changes: 7 additions & 7 deletions parquet/src/encodings/rle.rs
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions parquet/src/format.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions parquet_derive/src/parquet_field.rs
Expand Up @@ -68,7 +68,7 @@ impl Field {
///
/// struct Record {
/// a_bool: bool,
/// maybe_a_bool: Option<bool>
/// maybe_a_bool: `Option<bool>`
/// }
///
/// but not
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand All @@ -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 {
Expand Down

0 comments on commit 3bb7f38

Please sign in to comment.