Conversation
Reviewer's GuideSets up and enforces a nightly Rust formatter by pinning the toolchain, adding a custom File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
WalkthroughThe changes introduce a Changes
Possibly related PRs
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (5)
✅ Files skipped from review due to trivial changes (3)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms (1)
🔇 Additional comments (1)
✨ Finishing Touches
🧪 Generate Unit Tests
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Hey @leynos - I've reviewed your changes - here's some feedback:
- Consider adding a rust-toolchain.toml to pin the nightly toolchain version so contributors don’t need to update the CI workflow whenever the formatter version changes.
- Most functions formatted to single-line bodies now use explicit
return—you may want to drop thosereturnkeywords for a more idiomatic expression-based style in Rust.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Consider adding a rust-toolchain.toml to pin the nightly toolchain version so contributors don’t need to update the CI workflow whenever the formatter version changes.
- Most functions formatted to single-line bodies now use explicit `return`—you may want to drop those `return` keywords for a more idiomatic expression-based style in Rust.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
tests/integration.rs (1)
23-23: Consider idiomatic returns in one-line fixtures.One-line functions using explicit
returncould drop thereturnkeyword and trailing semicolon for a more idiomatic implicit return:fn broken_table() -> Vec<String> { lines_vec!("| A | B | |", "| 1 | 2 | | 3 | 4 |") }Also applies to: 54-54, 98-98, 101-101
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (8)
.github/workflows/ci.yml(1 hunks).rustfmt.toml(1 hunks)AGENTS.md(1 hunks)src/html.rs(5 hunks)src/lib.rs(9 hunks)src/main.rs(2 hunks)src/reflow.rs(1 hunks)tests/integration.rs(14 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (2)
src/reflow.rs (1)
src/lib.rs (2)
format_separator_cells(73-100)split_cells(36-70)
src/lib.rs (1)
src/html.rs (2)
convert_html_tables(282-325)lines(157-160)
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: build-test
🔇 Additional comments (20)
.rustfmt.toml (1)
1-14: New rustfmt configuration
The.rustfmt.tomlsettings are comprehensive and align with the project’s style guidelines, enforcing import grouping, comment wrapping, and shorthand syntax consistently.src/reflow.rs (1)
8-8: Import ordering adjusted
Theuse crate::{format_separator_cells, split_cells};statement is repositioned to follow external imports, matching the configured import grouping rules.src/main.rs (3)
1-5: Groupedstdimports
Consolidating allstd::{fs, io::{self, Read}, path::{Path, PathBuf}}imports into a single block improves readability and adheres to the new import layout rules.
41-42: Refined doc comment formain
The revised sentences break at 100 characters and clarify the function’s responsibilities, matching the comment wrapping configuration.
47-48: Enhanced return documentation
The updated# Returnssection clearly states success and error conditions, improving the API docs.src/html.rs (5)
9-9: Standard library import grouped first
Movinguse std::sync::LazyLock;into the std group aligns with theimports_granularity = "Crate"andgroup_importssettings.
11-11: External crate imports ordered
Thehtml5everimport is now grouped after the std imports, complying with theStdExternalCrategrouping rule.
181-182: Updated doc forpush_html_linebuffering
The description now succinctly states how lines are buffered and processed upon closure of an HTML table.
184-186: Expanded depth-tracking details
Additional sentences explain nesting depth updates and buffer management, improving clarity for maintainers.
224-227: Example formatting refined
The code example forhtml_table_to_markdownis now formatted across two lines for thevec!invocation, enhancing readability in docs.src/lib.rs (7)
16-18: Reordered imports and reexport
Thestd::{fs, path::Path}import andpub use html::convert_html_tables;reexport are aligned with crate-level grouping for consistency.
24-25:split_cellsdoc updated
The new comment lines wrap at 100 characters and clearly describe the trimming and splitting behaviour.
108-110:reflow_tabledocumentation enhanced
The description now details behaviour when column counts mismatch, aiding users in understanding fallback logic.
116-120:reflow_tableexample clarified
The sample invocation and output assertion are now better formatted and illustrate expected usage more clearly.
176-177:process_stream_innerdoc refined
The updated doc now summarises how tables are reflowed and code blocks preserved, aligning with the formatting rules.
379-380:process_streamdoc improved
The combined description succinctly covers HTML conversion, table reflow, and text wrapping in one place.
493-494:rewriteexample doc added import comment
Including theuse mdtablefix::rewrite;snippet makes the code sample self-contained.tests/integration.rs (2)
1-1: Consolidated import formatting is clear.Grouping
fs::Fileandio::Writeunder a singlestdimport improves readability and adheres to the new style rules.
14-15: Doc comment wrapping aligns with style guide.Reflowing and wrapping comments improves readability and consistency with the configured
rustfmtwidth settings. No logic changes here.Also applies to: 28-29, 129-130, 149-150, 231-232, 251-252, 254-255, 258-266, 286-288, 532-533, 547-551, 555-556, 577-578, 624-625
AGENTS.md (1)
97-101: Nightly toolchain formatting instructions updated correctly.The instructions now explicitly pin
nightly-2025-06-10forrustfmt,clippy, and tests, matching the CI workflow.
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
|
@sourcery-ai review |
There was a problem hiding this comment.
Code Health Improved
(2 files improve in Code Health)
Gates Passed
6 Quality Gates Passed
See analysis details in CodeScene
View Improvements
| File | Code Health Impact | Categories Improved |
|---|---|---|
| html.rs | 7.22 → 7.33 | Bumpy Road Ahead, Deep, Nested Complexity |
| lib.rs | 7.28 → 7.62 | Bumpy Road Ahead, Deep, Nested Complexity |
Quality Gate Profile: Pay Down Tech Debt
Want more control? Customize Code Health rules or catch issues early with our IDE extension and CLI tool.
There was a problem hiding this comment.
Hey @leynos - I've reviewed your changes - here's some feedback:
- Please split the PR into separate commits—one for adding nightly rustfmt and CI updates and another for the mass reformat—to simplify review and future rollbacks.
- Verify that replacing
cross buildwithcross +stable buildin the release workflow aligns with your toolchain requirements and doesn't conflict with the nightly pin. - Some conditional expressions are now awkwardly split across lines (e.g.
if let ... && ...); consider tweaking rustfmt settings to keep such conditions on a single line for readability.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Please split the PR into separate commits—one for adding nightly rustfmt and CI updates and another for the mass reformat—to simplify review and future rollbacks.
- Verify that replacing `cross build` with `cross +stable build` in the release workflow aligns with your toolchain requirements and doesn't conflict with the nightly pin.
- Some conditional expressions are now awkwardly split across lines (e.g. `if let ... && ...`); consider tweaking rustfmt settings to keep such conditions on a single line for readability.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
|
@coderabbitai Please create a new GitHub issue for the following: Some conditional expressions are now awkwardly split across lines (e.g. if let ... && ...); consider extracting relevant conditionals as predicate functions. |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain@leynos I've created a GitHub issue to track the concern about awkward conditional expressions being split across lines after the rustfmt changes. The issue has been assigned to you and includes backlinks to this PR and your comment for reference. 🏁 Script executed: Length of output: 786 @leynos ✅ I've successfully created GitHub issue #49 to track the concern about improving readability of conditional expressions that are now awkwardly split across lines by rustfmt. The issue has been assigned to you and includes the proper backlinks to this PR and your comment for reference. |
Summary
.rustfmt.tomlwith custom formatting rulesAGENTS.mdTesting
cargo clippy --all-targets --all-features -- -D warningsRUSTFLAGS="-D warnings" cargo testnpx -y markdownlint-cli2 '**/*.md'(fails: MD012, MD013, MD040, MD033)nixie docs/*.mdhttps://chatgpt.com/codex/tasks/task_e_684f7ca843f48322a2b98efdace740ae
Summary by Sourcery
Configure and enforce nightly rustfmt across the project
New Features:
.rustfmt.tomlwith custom formatting optionsrust-toolchain.tomlEnhancements:
CI:
Documentation:
cargo +nightly fmtworkflow inAGENTS.mdSummary by CodeRabbit
Chores
Style
Documentation