Skip to content

Tidy up the docs in auto-generated Rust bindings#4294

Merged
amaanq merged 1 commit intotree-sitter:masterfrom
LikeLakers2:tidy-up-generated-lib-rs-docs
Apr 19, 2025
Merged

Tidy up the docs in auto-generated Rust bindings#4294
amaanq merged 1 commit intotree-sitter:masterfrom
LikeLakers2:tidy-up-generated-lib-rs-docs

Conversation

@LikeLakers2
Copy link
Contributor

@LikeLakers2 LikeLakers2 commented Mar 17, 2025

Hi there! I was looking into tree-sitter out of curiousity, and while messing about with it, I noticed that the doc-comments in the generated Rust bindings were formatted a little oddly.

I thought to tidy up the doc-comments a little. In particular, I did the following things:

  • I removed a couple useless [] which appear after the text portion of a link. For example, [tree-sitter][] became [tree-sitter]. Thanks to how markdown handles reference-style links, these still link to the same place.

  • Where a link refers to a item (such as a struct or const), I changed the link's text to be in backticks, such that it shows up in a in-line code block. For example, [Parser] became [`Parser`]. This brings item links in line with how many Rust crates link to items.

  • I changed the link to tree_sitter::Parser to include the exact version of the tree_sitter crate used by the binding crate, rather than version *. This ensures that the linked documentation links to the relevant version of the crate (whether the relevant version is the latest version or not).

  • I removed the reference link definition for tree_sitter_language::LanguageFn. This causes rustdoc to link to the LanguageFn item that's already in scope - which incidentally also ensures that the link will go to the exact version of tree_sitter_language used by the binding crate.

This should not result in any functional or visual differences to the doc (aside from the LANGUAGE and Parser links now looking like in-line code blocks).

@LikeLakers2
Copy link
Contributor Author

LikeLakers2 commented Mar 17, 2025

I'm unsure why the CI is failing - I didn't touch any actual code, and none of the errors seem related to rustdoc or expected file output.

Hopefully it's just a weird CI thing, or a flaky test.

Seems it's fixed. :D

@LikeLakers2 LikeLakers2 changed the title Tidy up the docs in generated lib.rs files Tidy up the docs in auto-generated Rust bindings Mar 17, 2025
@amaanq
Copy link
Member

amaanq commented Apr 19, 2025

nice, thanks!

@amaanq amaanq merged commit 853ca46 into tree-sitter:master Apr 19, 2025
19 checks passed
@LikeLakers2 LikeLakers2 deleted the tidy-up-generated-lib-rs-docs branch April 19, 2025 04:37
@WillLillis WillLillis added the ci:backport release-0.25 Backport label label Apr 19, 2025
@tree-sitter-ci-bot
Copy link

Successfully created backport PR for release-0.25:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants