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

Small fixes modules and macros #163

Merged
merged 3 commits into from
Mar 19, 2024
Merged

Conversation

luukvanderduim
Copy link
Collaborator

  • Remove unnecessary pub visibility on test-time modules.

  • Remove #[macro_export] from top of macros module.
    #[macro_export] does not work on a whole module and it is intended to make a macro available outside the crate. We do not want these macros to be part of our public API.

The way we make the modules available across the crate modules is by:

#[macro_use]
pub(crate) mod macros;

We have some macros of which Clippy thinks are unused. They are used, but only in the test profile.
This adds a comment explaining why we make the macro available under test only.
(Alternatively we could opt-out of the lint. )

Copy link

codecov bot commented Mar 14, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.41%. Comparing base (6097ab7) to head (e0cdd5a).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #163      +/-   ##
==========================================
+ Coverage   89.38%   89.41%   +0.03%     
==========================================
  Files          39       39              
  Lines        3268     3268              
==========================================
+ Hits         2921     2922       +1     
+ Misses        347      346       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

- The attribute does not work on the module a a whole.
- We intend to use these macros in atspi-common only.

We use:

```rust
#[macro_use]
pub(crate) mod macros;
```
in libs, which satisfies our our needs.
We decorate the macro with a `#[cfg(test)]` attribute.
This prevents Clippy from complaining about the macro not being used. It is being used, but only in test mode.
@luukvanderduim luukvanderduim merged commit ca63d6c into main Mar 19, 2024
13 checks passed
@luukvanderduim luukvanderduim deleted the small_fixes_modules_and_macros branch March 19, 2024 12:51
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.

1 participant