Closed
Description
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.