Skip to content

feature external_doc not traversed by rustfmt #60997

Description

@kentfredric

When using the nightly external doc feature #44732 , rustfmt ceases to be able to tidy code blocks in the documentation.

As a test, I put a documentation code block that was previously in a .rs file into an include='d .md file, intentionally made it a mess, and observed that rustfmt no longer made it look readable:

```no_run
use grease::repository::CategoryFileIterator;let iterator = CategoryFileIterator::for_file( "/usr/portage",  "/usr/portage/profiles/categories",);for item_result in iterator.unwrap() {  println!("{}", item_result.unwrap().name());}
```

And rustfmt did not indicate any attempts to format this file:

rustfmt --edition 2018 /home/kent/rust/grease/src/lib.rs --verbose
Using rustfmt config file /home/kent/rust/grease/rustfmt.toml for /home/kent/rust/grease/src/lib.rs
Formatting /home/kent/rust/grease/src/lib.rs
Formatting /home/kent/rust/grease/src/repository/category.rs
Formatting /home/kent/rust/grease/src/repository/ebuild.rs
Formatting /home/kent/rust/grease/src/repository/package.rs
Formatting /home/kent/rust/grease/src/repository.rs
Spent 0.002 secs in the parsing phase, and 0.009 secs in the formatting phase

I imagine being able to format these external files would be something that should work prior to this feature being stabilized, or at very least, rustfmt should gain options so that it can do this.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.F-external_doc`#![feature(external_doc)]`T-dev-toolsRelevant to the dev-tools subteam, which will review and decide on the PR/issue.T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions