-
Notifications
You must be signed in to change notification settings - Fork 87
chore: deny let_underscore_drop #5095
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| if nullability == Nullability::Nullable { | ||
| // Try casting to non-nullable (may fail if nulls present) | ||
| let _ = cast(array, &DType::Bool(Nullability::NonNullable)); | ||
| cast(array, &DType::Bool(Nullability::NonNullable)).vortex_unwrap(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file had several tests that did not actually run their tests because they didn't try to unwrap the result.
| let session = SessionContext::new_with_state(session_state_builder.build()); | ||
|
|
||
| let _ = session | ||
| let _unused = session |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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? ?
There was a problem hiding this comment.
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).
| fn replace_children() { | ||
| let expr = cast(root(), DType::Bool(Nullability::Nullable)); | ||
| let _ = expr.with_children(vec![root()]); | ||
| expr.with_children(vec![root()]).vortex_unwrap(); |
There was a problem hiding this comment.
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.
vortex-expr/src/exprs/is_null.rs
Outdated
| fn replace_children() { | ||
| let expr = is_null(root()); | ||
| let _ = expr.with_children(vec![root()]); | ||
| expr.with_children(vec![root()]).vortex_unwrap(); |
There was a problem hiding this comment.
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.
vortex-io/src/limit.rs
Outdated
|
|
||
| // After consuming, should be able to push again | ||
| let _ = stream.next().await; | ||
| assert!(stream.next().await.is_some()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems like a reasonable assertion to me. The stream ought to have that one element we put into it!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can just do .unwrap() in that case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
| let mask1 = Mask::new_true(5); | ||
| let mask2 = Mask::new_true(3); | ||
| let _ = &mask1 & &mask2; | ||
| let _unused = &mask1 & &mask2; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bitand has a lint which prevents me from completely ignoring the result a la &mask1 & &mask2.
Masks have non-trivial drops (I think, an Arc).
CodSpeed Performance ReportMerging #5095 will not alter performanceComparing Summary
Footnotes
|
|
Blocked on fixing our conformance tests: #5101 |
Deploying vortex-bench with
|
| Latest commit: |
304d033
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://b2d55f2e.vortex-93b.pages.dev |
| Branch Preview URL: | https://dk-let-underscore-drop.vortex-93b.pages.dev |
Codecov Report❌ Patch coverage is
☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
the only place I really have used |
| 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)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unwrap the result
There was a problem hiding this comment.
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?,
}
vortex-duckdb/build.rs
Outdated
| let duckdb_library_dir = target_dir.join("duckdb-lib"); | ||
|
|
||
| let _ = fs::remove_dir_all(&duckdb_library_dir); | ||
| drop(fs::remove_dir_all(&duckdb_library_dir)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unwrap the result here too
| // 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))); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
Yeah this is my argument. |
I'm curious for opinions on this. I stubbed my toe recently on: ``` let _ = span.enter(); ``` Which does not enter the span for the remainder of the function (it immediately drops the span). There is already a by-default-deny lint for `let _ = lock()` but no such lint for other guard-like things: - [`tracing::Span::enter()`](https://docs.rs/tracing/latest/tracing/struct.Span.html#method.enter) - [`xshell::Shell::push_dir`](https://docs.rs/xshell/latest/xshell/struct.Shell.html#method.push_dir) Signed-off-by: Daniel King <[email protected]>
Signed-off-by: Daniel King <[email protected]>
Signed-off-by: Daniel King <[email protected]>
Signed-off-by: Daniel King <[email protected]>
Signed-off-by: Daniel King <[email protected]>
2e5035d to
1d817cf
Compare
I'm curious for opinions on this.
I stubbed my toe recently on:
Which does not enter the span for the remainder of the function (it immediately drops the span). There is already a by-default-deny lint for
let _ = lock()but no such lint for other guard-like things:tracing::Span::enter()xshell::Shell::push_dir