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

doc: refactor Function case to use write_section method #10037

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

VolodymyrBg
Copy link

Motivation

In crates/doc/src/writer/as_doc.rs, there was a TODO comment in the ParseSource::Function case indicating that cleanup was needed. The implementation for this case used separate method calls for writing documentation and code, while other similar cases used the more concise write_section method.
This PR aims to improve code consistency and maintainability by standardizing the approach used across different parse source types.

Solution

The solution replaces multiple method calls with a single call to write_section, which handles both writing documentation and code in one operation:

  • Removed the TODO comment
  • Replaced separate calls to writeln_doc and write_code with a single write_section call
  • Maintained the exact same functionality
  • Made the code more consistent with the patterns used for other parse source types in the same file

This change brings the Function case in line with the implementation pattern used for Struct, Event, Error, and other parse source types.

PR Checklist

  • Added Tests
  • Added Documentation
  • Breaking changes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

1 participant