Skip to content
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

Remove unreachable pubs #958

Merged
merged 3 commits into from
Mar 14, 2024
Merged

Conversation

Lorak-mmk
Copy link
Collaborator

@Lorak-mmk Lorak-mmk commented Mar 14, 2024

Up until now some structs / fields etc were marked as pub despite not being a part of public API.
This is confusing when reading code: in order to know if something is truly public you need to check all the modules up to lib.rs to verify that each appears in some pub use.

This PR removes all such occurrences - now something is public if and only if it is marked as pub.
It also enables rustc lint unreachable-pub to prevent such occurences in the future.

Pre-review checklist

  • I have split my patch into logically separate commits.
  • All commit messages clearly explain what they change and why.
  • I added relevant tests for new features and bug fixes.
  • All commits compile, pass static checks and pass test.
  • PR description sums up the changes and reasons why they should be introduced.
  • I have provided docstrings for the public items that I want to introduce.
  • I have adjusted the documentation in ./docs/source/.
  • I added appropriate Fixes: annotations to PR description.

Copy link

github-actions bot commented Mar 14, 2024

cargo semver-checks found no API-breaking changes in this PR! 🎉🥳
Checked commit: ce0e9f7

@Lorak-mmk Lorak-mmk marked this pull request as ready for review March 14, 2024 12:25
scylla-proxy/src/actions.rs Outdated Show resolved Hide resolved
@Lorak-mmk Lorak-mmk force-pushed the remove-unreachable-pubs branch from 247efff to 624e445 Compare March 14, 2024 14:50
Previously this was a struct which had only one purpose: provide
some associated functions. This is exactly what a module is, so let's
use a module.
Some structs / fields etc were marked as pub despite not being a part of
public API. This is confusing when reading code: in order to know if
something is truly public you need to check all the modules up to lib.rs
to verify that each appears in some `pub use`.

This commit removes all such occurrences - now something is public if and
only if it is marked as pub.
@Lorak-mmk Lorak-mmk force-pushed the remove-unreachable-pubs branch from 624e445 to 8ae6a91 Compare March 14, 2024 16:58
scylla-cql/Cargo.toml Outdated Show resolved Hide resolved
In order to prevent the problem that previous commit fixed, enable this
lint for all of our crates.

fixup
@Lorak-mmk Lorak-mmk force-pushed the remove-unreachable-pubs branch from 8ae6a91 to ce0e9f7 Compare March 14, 2024 17:56
@wprzytula wprzytula merged commit 245ae7d into scylladb:main Mar 14, 2024
11 checks passed
@Lorak-mmk Lorak-mmk self-assigned this Mar 18, 2024
@Lorak-mmk Lorak-mmk mentioned this pull request May 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants