Skip to content

Decompose src/wrap.rs to meet 400-line limit #240

@coderabbitai

Description

@coderabbitai

Description

The file src/wrap.rs contains 428 lines, exceeding the 400-line guideline from coding guidelines. Extract additional helpers into submodules to improve cohesion and comply with the file-length constraint.

Tasks

  • Extract wrap_preserving_code and related inline-code helpers (determine_token_span, merge_code_span, extend_punctuation, looks_like_link, is_whitespace_token, is_inline_code_token, is_trailing_punct, attach_punctuation_to_previous_line) into a new submodule src/wrap/inline.rs
  • Extract paragraph-level helpers (flush_paragraph, handle_prefix_line, append_wrapped_with_prefix) into src/wrap/paragraph.rs
  • Update src/wrap.rs to declare mod inline; and mod paragraph;
  • Update src/wrap.rs to use inline::wrap_preserving_code and paragraph::{flush_paragraph, handle_prefix_line} where needed
  • Adjust visibility to pub(super) or pub(crate) as appropriate
  • Run cargo test to ensure the refactored modules compile and all tests pass

Reference

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions