Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,7 @@ package = "getrandom"
version = "0.3.1"

[workspace.lints.rust]
let_underscore_drop = "deny"
macro_use_extern_crate = "deny"
redundant_lifetimes = "deny"
unsafe_op_in_unsafe_fn = "deny"
Expand Down
2 changes: 1 addition & 1 deletion bench-vortex/src/clickbench/clickbench_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ impl Flavor {
let pool = rayon::ThreadPoolBuilder::new()
.thread_name(|i| format!("clickbench download {i}"))
.build()?;
let _ = pool.install(|| (0_u32..100).into_par_iter().map(|idx| {
let _unused = pool.install(|| (0_u32..100).into_par_iter().map(|idx| {
let output_path = basepath.join(Format::Parquet.name()).join(format!("hits_{idx}.parquet"));
idempotent(&output_path, |output_path| {
info!("Downloading file {idx}");
Expand Down
2 changes: 1 addition & 1 deletion encodings/sparse/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ mod test {
#[should_panic(expected = "out of bounds")]
fn test_scalar_at_oob() {
let array = sparse_array(nullable_fill());
let _ = array.scalar_at(10);
array.scalar_at(10);
}

#[test]
Expand Down
2 changes: 1 addition & 1 deletion encodings/zstd/src/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,5 +196,5 @@ fn test_sliced_array_children() {
let compressed =
ZstdArray::from_primitive(&PrimitiveArray::from_option_iter(data), 0, 100).unwrap();
let sliced = compressed.slice(0..4);
let _ = sliced.children();
sliced.children();
}
2 changes: 1 addition & 1 deletion vortex-array/src/arrays/datetime/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ fn test_timestamp_fails_i32() {
let ts = buffer![100i32].into_array();
let ts_array = ts.into_array();

let _ = TemporalArray::new_timestamp(ts_array, TimeUnit::Seconds, None);
TemporalArray::new_timestamp(ts_array, TimeUnit::Seconds, None);
}

#[rstest]
Expand Down
14 changes: 7 additions & 7 deletions vortex-array/src/arrays/list/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -776,7 +776,7 @@ fn test_negative_offset_values() {
let offsets = buffer![-1i32, 2, 4, 5].into_array();
let validity = Validity::AllValid;

let _ = ListArray::try_new(elements, offsets, validity).unwrap();
ListArray::try_new(elements, offsets, validity).unwrap();
}

#[test]
Expand All @@ -786,7 +786,7 @@ fn test_unsorted_offsets() {
let offsets = buffer![0u32, 3, 2, 5].into_array();
let validity = Validity::AllValid;

let _ = ListArray::try_new(elements, offsets, validity).unwrap();
ListArray::try_new(elements, offsets, validity).unwrap();
}

#[test]
Expand All @@ -796,7 +796,7 @@ fn test_offset_exceeding_elements_length() {
let offsets = buffer![0u32, 2, 4, 7].into_array();
let validity = Validity::AllValid;

let _ = ListArray::try_new(elements, offsets, validity).unwrap();
ListArray::try_new(elements, offsets, validity).unwrap();
}

#[test]
Expand All @@ -809,7 +809,7 @@ fn test_validity_length_mismatch() {
Nullability::Nullable,
);

let _ = ListArray::try_new(elements, offsets, validity).unwrap();
ListArray::try_new(elements, offsets, validity).unwrap();
}

#[test]
Expand All @@ -819,7 +819,7 @@ fn test_nullable_offsets() {
let offsets = PrimitiveArray::from_option_iter([Some(0u32), Some(2), None, Some(5)]);
let validity = Validity::AllValid;

let _ = ListArray::try_new(elements, offsets.into_array(), validity).unwrap();
ListArray::try_new(elements, offsets.into_array(), validity).unwrap();
}

#[test]
Expand All @@ -829,7 +829,7 @@ fn test_empty_offsets_array() {
let offsets = PrimitiveArray::empty::<u32>(Nullability::NonNullable);
let validity = Validity::AllValid;

let _ = ListArray::try_new(elements, offsets.into_array(), validity).unwrap();
ListArray::try_new(elements, offsets.into_array(), validity).unwrap();
}

#[test]
Expand All @@ -839,7 +839,7 @@ fn test_non_integer_offsets() {
let offsets = buffer![0.0f32, 2.0, 4.0, 5.0].into_array();
let validity = Validity::AllValid;

let _ = ListArray::try_new(elements, offsets, validity).unwrap();
ListArray::try_new(elements, offsets, validity).unwrap();
}

#[test]
Expand Down
2 changes: 1 addition & 1 deletion vortex-array/src/patches.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1675,7 +1675,7 @@ mod test {

// Mask with wrong length
let mask = Mask::from_iter([false, false, true, false, false]);
let _ = patches.mask(&mask).unwrap();
patches.mask(&mask).unwrap();
}

#[test]
Expand Down
1 change: 1 addition & 0 deletions vortex-cxx/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ pub(crate) static SESSION: LazyLock<VortexSession> =
LazyLock::new(|| VortexSession::default().with_handle(RUNTIME.handle()));

#[cxx::bridge(namespace = "vortex::ffi")]
#[allow(let_underscore_drop)]
mod ffi {
extern "Rust" {
type DType;
Expand Down
2 changes: 1 addition & 1 deletion vortex-datafusion/src/persistent/sink.rs
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ mod tests {
register_vortex_format_factory(factory, &mut session_state_builder);
let session = SessionContext::new_with_state(session_state_builder.build());

let _ = session
let _unused = session
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a bit suspicious to me? Shouldn't we fail if the external table fails to create?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isn't that handled by the .await? ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, yes, you're right. This is flagged because DataFrame has a non-trivial Drop (probably drops some Arcs).

.sql(&format!(
"CREATE EXTERNAL TABLE my_tbl \
(c1 VARCHAR NOT NULL, c2 INT NOT NULL) \
Expand Down
4 changes: 2 additions & 2 deletions vortex-dtype/src/arrow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ mod test {
#[test]
#[should_panic]
fn test_dtype_conversion_panics() {
let _ = DType::Extension(Arc::new(ExtDType::new(
DType::Extension(Arc::new(ExtDType::new(
ExtID::from("my-fake-ext-dtype"),
Arc::new(DType::Utf8(Nullability::NonNullable)),
None,
Expand Down Expand Up @@ -380,6 +380,6 @@ mod test {
#[should_panic]
fn test_schema_conversion_panics(the_struct: StructFields) {
let schema_null = DType::Struct(the_struct, Nullability::Nullable);
let _ = schema_null.to_arrow_schema().unwrap();
schema_null.to_arrow_schema().unwrap();
}
}
13 changes: 10 additions & 3 deletions vortex-duckdb/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#![allow(clippy::unwrap_used)]
#![allow(clippy::expect_used)]
use std::io::ErrorKind;
use std::path::{Path, PathBuf};
use std::{env, fs};

Expand Down Expand Up @@ -44,7 +45,10 @@ fn download_duckdb_lib_archive() -> Result<PathBuf, Box<dyn std::error::Error>>
let archive_path = duckdb_dir.join(&archive_name);

// Recreate the duckdb directory
let _ = fs::remove_dir_all(&duckdb_dir);
match fs::remove_dir_all(&duckdb_dir) {
Err(err) if err.kind() == ErrorKind::NotFound => (),
otherwise => otherwise?,
}
fs::create_dir_all(&duckdb_dir)?;

if !archive_path.exists() {
Expand Down Expand Up @@ -192,7 +196,10 @@ fn build_duckdb(duckdb_source_root: &Path) -> Result<PathBuf, Box<dyn std::error
let target_dir = manifest_dir.parent().unwrap().join("target");
let duckdb_library_dir = target_dir.join("duckdb-lib");

let _ = fs::remove_dir_all(&duckdb_library_dir);
match fs::remove_dir_all(&duckdb_library_dir) {
Err(err) if err.kind() == ErrorKind::NotFound => (),
otherwise => otherwise?,
}
fs::create_dir_all(&duckdb_library_dir)?;

// Copy .dylib and .so files (macOS and Linux).
Expand Down Expand Up @@ -223,7 +230,7 @@ fn main() {
// Download, extract and symlink DuckDB source code.
let zip_source_path = download_duckdb_source_archive().unwrap();
let extracted_source_path = extract_duckdb_source(zip_source_path).unwrap();
let _ = fs::remove_dir_all(&duckdb_repo);
drop(fs::remove_dir_all(&duckdb_repo));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unwrap the result

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I went with the following because I think the intention is to not fail if the directory already exists (but I agree we should fail if there's, e.g. a permissions issue or some other weird problem).

    match fs::remove_dir_all(&duckdb_dir) {
        Err(err) if err.kind() == ErrorKind::NotFound => (),
        otherwise => otherwise?,
    }

std::os::unix::fs::symlink(&extracted_source_path, &duckdb_repo).unwrap();

let library_path =
Expand Down
2 changes: 1 addition & 1 deletion vortex-duckdb/src/duckdb/object_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use crate::{cpp, lifetime_wrapper};
unsafe extern "C-unwind" fn rust_box_deleter<T>(ptr: *mut c_void) {
if !ptr.is_null() {
unsafe {
let _ = Box::from_raw(ptr as *mut T);
drop(Box::from_raw(ptr as *mut T));
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion vortex-expr/src/exprs/cast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ mod tests {
use vortex_array::arrays::StructArray;
use vortex_buffer::buffer;
use vortex_dtype::{DType, Nullability, PType};
use vortex_error::VortexUnwrap as _;

use super::cast;
use crate::exprs::get_item::get_item;
Expand All @@ -155,7 +156,7 @@ mod tests {
#[test]
fn replace_children() {
let expr = cast(root(), DType::Bool(Nullability::Nullable));
let _ = expr.with_children([root()]);
expr.with_children(vec![root()]).vortex_unwrap();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This did not test what it claimed to test.

}

#[test]
Expand Down
3 changes: 2 additions & 1 deletion vortex-expr/src/exprs/is_null.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ mod tests {
use vortex_array::stats::Stat;
use vortex_buffer::buffer;
use vortex_dtype::{DType, Field, FieldPath, FieldPathSet, Nullability};
use vortex_error::VortexUnwrap as _;
use vortex_scalar::Scalar;
use vortex_utils::aliases::hash_map::HashMap;

Expand All @@ -122,7 +123,7 @@ mod tests {
#[test]
fn replace_children() {
let expr = is_null(root());
let _ = expr.with_children([root()]);
expr.with_children([root()]).vortex_unwrap();
}

#[test]
Expand Down
3 changes: 2 additions & 1 deletion vortex-gpu/src/jit/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,12 @@ pub fn create_run_jit_kernel(
.record_event(Some(CU_EVENT_DEFAULT))
.ok()
.vortex_expect("Failed to record event");
let _ = unsafe {
let launched = unsafe {
launch_builder
.launch(launch_config)
.map_err(|e| vortex_err!("failed to launch kernel {e}"))?
};
drop(launched);
let end = stream
.record_event(Some(CU_EVENT_DEFAULT))
.ok()
Expand Down
2 changes: 1 addition & 1 deletion vortex-io/src/file/read/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ impl Drop for ReadFuture {
fn drop(&mut self) {
// When the FileHandle is dropped, we can send a shutdown event to the I/O stream.
// If the I/O stream has already been dropped, this will fail silently.
let _ = self.events.unbounded_send(ReadEvent::Dropped(self.id));
drop(self.events.unbounded_send(ReadEvent::Dropped(self.id)));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should also unwrap the result i think?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh i see, we don't want to panic in the drop impl here.

}
}

Expand Down
6 changes: 3 additions & 3 deletions vortex-io/src/io_buf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -446,14 +446,14 @@ mod tests {
fn test_owned_slice_invalid_range() {
let data = vec![1, 2, 3];
#[allow(clippy::reversed_empty_ranges)]
let _ = data.slice_owned(5..3); // start > end
data.slice_owned(5..3); // start > end
}

#[test]
#[should_panic(expected = "exceeds buffer length")]
fn test_owned_slice_out_of_bounds() {
let data = vec![1, 2, 3];
let _ = data.slice_owned(1..10); // end > len
data.slice_owned(1..10); // end > len
}

#[test]
Expand All @@ -467,7 +467,7 @@ mod tests {
#[should_panic(expected = "exceeds buffer length")]
fn test_owned_slice_start_out_of_bounds() {
let data = vec![1, 2, 3];
let _ = data.slice_owned(10..11); // start > len
data.slice_owned(10..11); // start > len
}

// Buffer overflow protection tests
Expand Down
5 changes: 4 additions & 1 deletion vortex-io/src/limit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,10 @@ mod tests {
assert!(result.is_err());

// After consuming, should be able to push again
let _ = stream.next().await;
stream
.next()
.await
.expect("The 10 byte vector ought to be in there!");
assert_eq!(stream.bytes_available(), 10);

let result = stream.try_push(Box::pin(async { vec![1u8; 5] }), 5);
Expand Down
6 changes: 3 additions & 3 deletions vortex-io/src/runtime/handle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ impl Handle {
let abort_handle = self.runtime().spawn(
async move {
// Task::detach allows the receiver to be dropped, so we ignore send errors.
let _ = send.send(f.await);
drop(send.send(f.await));
}
.boxed(),
);
Expand Down Expand Up @@ -106,7 +106,7 @@ impl Handle {
// Optimistically avoid the work if the result won't be used.
if !send.is_closed() {
// Task::detach allows the receiver to be dropped, so we ignore send errors.
let _ = send.send(f());
drop(send.send(f()));
}
}));
Task {
Expand All @@ -126,7 +126,7 @@ impl Handle {
// Optimistically avoid the work if the result won't be used.
if !send.is_closed() {
// Task::detach allows the receiver to be dropped, so we ignore send errors.
let _ = send.send(f());
drop(send.send(f()));
}
}));
Task {
Expand Down
16 changes: 9 additions & 7 deletions vortex-io/src/runtime/single.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,11 @@ impl Sender {
while let Ok(spawn) = scheduling_recv.as_async().recv().await {
if let Some(local) = weak_local2.upgrade() {
// Ignore send errors since it means the caller immediately detached.
let _ = spawn
.task_callback
.send(SmolAbortHandle::new_handle(local.spawn(spawn.future)));
drop(
spawn
.task_callback
.send(SmolAbortHandle::new_handle(local.spawn(spawn.future))),
);
}
}
})
Expand All @@ -72,9 +74,9 @@ impl Sender {
if let Some(local) = weak_local2.upgrade() {
let work = spawn.sync;
// Ignore send errors since it means the caller immediately detached.
let _ = spawn.task_callback.send(SmolAbortHandle::new_handle(
drop(spawn.task_callback.send(SmolAbortHandle::new_handle(
local.spawn(async move { work() }),
));
)));
}
}
})
Expand All @@ -88,9 +90,9 @@ impl Sender {
if let Some(local) = weak_local2.upgrade() {
let work = spawn.sync;
// Ignore send errors since it means the caller immediately detached.
let _ = spawn.task_callback.send(SmolAbortHandle::new_handle(
drop(spawn.task_callback.send(SmolAbortHandle::new_handle(
local.spawn(async move { work() }),
));
)));
}
}
})
Expand Down
6 changes: 3 additions & 3 deletions vortex-io/src/runtime/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -290,9 +290,9 @@ async fn test_custom_io_source() {
let file_read = handle.open_read(source, Default::default()).unwrap();

// Perform several reads
let _ = file_read.read_at(0, 5, Alignment::new(1)).await.unwrap();
let _ = file_read.read_at(5, 5, Alignment::new(1)).await.unwrap();
let _ = file_read.read_at(10, 5, Alignment::new(1)).await.unwrap();
file_read.read_at(0, 5, Alignment::new(1)).await.unwrap();
file_read.read_at(5, 5, Alignment::new(1)).await.unwrap();
file_read.read_at(10, 5, Alignment::new(1)).await.unwrap();

// Check that our custom IoSource was called 3 times
assert_eq!(read_count.load(Ordering::SeqCst), 3);
Expand Down
Loading
Loading