Skip to content

Conversation

@Nachiket-Roy
Copy link
Contributor

Which issue does this PR close?

Closes N/A (no existing issue)
This change addresses a compiler warning observed during local test runs and does not correspond to a tracked bug or feature request.

Rationale for this change

During local test runs, the helper function ctx_and_codec in datafusion/ffi/tests/utils triggered a dead_code warning.
While the function is currently unused, it encapsulates non-trivial setup logic for FFI integration tests and is expected to be reused as FFI test coverage expands.
This change documents the intent of the helper and explicitly marks it as intentionally retained scaffolding, improving code clarity.

What changes are included in this PR?

  • Added documentation explaining the purpose of the ctx_and_codec helper
  • Explicitly marked the helper as intentionally unused to silence dead_code warnings

Are these changes tested?

Yes.

  • This change is documentation-only and does not affect runtime behavior.
  • Existing test coverage remains unchanged and continues to pass.

Are there any user-facing changes?

No.
This PR only affects internal test utilities and does not impact public APIs or user-facing behavior.

@github-actions github-actions bot added the ffi Changes to the ffi crate label Dec 27, 2025
// for use in FFI integration tests.
// This helper centralizes setup logic and is kept intentionally
// for upcoming FFI test expansions.
#[allow(dead_code)]
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
#[allow(dead_code)]
#[expect(dead_code)]

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the review. Updated to #[expect(dead_code)].

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The lint expectation is currently unfulfilled so #[expect(dead_code)] fails CI.
Should I revert this back to #[allow(dead_code)] for now and switch to #[expect] once the lint actually triggers?

Copy link
Contributor

Choose a reason for hiding this comment

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

We should figure out why it isn't fulfilled in that case; it doesn't make sense that allow suppresses a lint that isn't fulfilled if we replace it with expect unless its a bug in the linter. Perhaps check if it occurs when a certain feature is enabled/disabled?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The helper is used by FFI integration tests, but its usage depends on which tests and features are compiled. In some configurations, the compiler does not see any references to it and therefore does not emit a dead_code lint. In those cases, #[expect(dead_code)] fails because the lint is not triggered, while #[allow(dead_code)] still works since it does not require the lint to be emitted.

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’ve switched this back to #[allow(dead_code)] for now. Since the dead_code lint isn’t consistently emitted across all test / feature configurations, using #[expect(dead_code)] causes failures when the lint doesn’t trigger. allow avoids that while still documenting the intent.

Copy link
Contributor

Choose a reason for hiding this comment

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

#[cfg_attr(not(feature = "integration-tests"), expect(dead_code))]

This should work; it conditionally expects this as dead code if not using integration-tests feature

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Alright. Thanks.

@Dandandan Dandandan added this pull request to the merge queue Dec 28, 2025
Merged via the queue into apache:main with commit d825e5f Dec 28, 2025
28 checks passed
@Nachiket-Roy Nachiket-Roy deleted the docs/unused-test branch December 28, 2025 19:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ffi Changes to the ffi crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants