Contribute to library documentation

Being new to Rust, I tend to read standard library documentation a lot. Every once in a while, I come across a passage that was not clear to me right away, and I'd like to contribute suggestions for improvements of documentation.
What is the process for this?

1 Like

Hi there!
Thanks for wanting to contribute to the documentation!

Probably the best way to do this is to open either an issue or a PR on the rust GitHub page:

OK, I'll do that. Thanks for getting back to me!

Most crates out there have a github/gitlab repository (you will need an account for these sites):

  1. go the project's repository website

  2. fork the project

    • Now you should have a "copy" of the original repository within your account
  3. edit your fork as you please (git clone your_repo to edit from within your machine)

    • For instance, in the case of the documentation, search for the docstrings:

      /// This is a spuer function
      fn my_super_function () {
          ...
      

      you change the code to fix it:

      /// This is a super function
      fn my_super_function () {
          ...
      
  4. If editing from within your machine,
    git add -p src/changed/file.rs, then git commit and finally git push.

  5. then, within the repository url, you can go and submit a PR across forks.


If the edit is small (e.g., just a minor change in a docstring), you can skip the part where you edit locally, and do the changes within your web browser:

  1. Locate the Github repository

  2. Edit the targeted file (by forking):

  3. Make the desired changes:

  4. Preview you changes and add an explicit description of your change (commit message and initial PR title):

4 Likes

thanks