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

error-stack: clarify documentation of HookContext #1987

Merged
merged 8 commits into from Jan 31, 2023

Conversation

indietyp
Copy link
Member

🌟 What is the purpose of this PR?

#1693 separated fmt::HookContext into hook::HookContext and fmt::HookContext, so that it can be used in #1558. While working, the problem is that documentation doesn't render correctly because hook::HookContext is private in public. Therefore unreachable rustdoc is unable to navigate to the type, and the documentation is incomplete.

This PR moves to a macro-based approach to enable better documentation. Instead of using an unreachable public type, we have a macro that implements the necessary common functions. This is by far not ideal, but I found this to be the best way without compromising #1558 or future hooks.

@codecov
Copy link

codecov bot commented Jan 31, 2023

Codecov Report

Merging #1987 (c8273d9) into main (bfb341a) will decrease coverage by 0.54%.
The diff coverage is 8.54%.

@@            Coverage Diff             @@
##             main    #1987      +/-   ##
==========================================
- Coverage   57.59%   57.06%   -0.54%     
==========================================
  Files         265      265              
  Lines       18940    19118     +178     
  Branches      421      421              
==========================================
  Hits        10909    10909              
- Misses       8026     8204     +178     
  Partials        5        5              
Flag Coverage Δ
backend-integration-tests 3.66% <ø> (ø)
error-stack 82.54% <8.54%> (-8.50%) ⬇️
unit-tests 1.49% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
packages/libs/error-stack/src/lib.rs 38.46% <ø> (ø)
packages/libs/error-stack/src/fmt/hook.rs 44.30% <0.54%> (-53.66%) ⬇️
packages/libs/error-stack/src/hook/context.rs 78.89% <94.11%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

TimDiekmann
TimDiekmann previously approved these changes Jan 31, 2023
Copy link
Member

@TimDiekmann TimDiekmann left a comment

Choose a reason for hiding this comment

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

Thanks, @indietyp, this is much better (and also does unbreak SemVer for this struct) 🎉

@indietyp
Copy link
Member Author

I took the liberty of cleaning fmt::hook up and re-enabling dead_code and unused_imports.

TimDiekmann
TimDiekmann previously approved these changes Jan 31, 2023
@indietyp
Copy link
Member Author

Sorry, @TimDiekmann, I need another review D: I just realized that I can remove all cfg guards in the hook.rs because it is only conditionally enabled anyway.

TimDiekmann
TimDiekmann previously approved these changes Jan 31, 2023
Copy link
Member

@TimDiekmann TimDiekmann left a comment

Choose a reason for hiding this comment

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

I think the last commit was a good idea 😄

@indietyp
Copy link
Member Author

/trunk merge

@trunk-io
Copy link

trunk-io bot commented Jan 31, 2023

🚫 This pull request has been removed from the merge queue (details).

@trunk-io trunk-io bot merged commit 61a1610 into main Jan 31, 2023
@trunk-io trunk-io bot deleted the bm/es/hookcontext-docs branch January 31, 2023 18:31
@trunk-io
Copy link

trunk-io bot commented Jan 31, 2023

😎 Merged successfully (details).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/libs > error-stack Affects the `error-stack` crate (library)
Development

Successfully merging this pull request may close these issues.

None yet

2 participants