Closed
Description
openedon Dec 19, 2020
Input
//! Some docs here
#![cfg_attr(bootstrap, doc = "xxx")]
#![cfg_attr(debug_assertions, stable(feature = "rust1", since = "1.0.0"))]
Output
//! Some docs here
#![cfg_attr(bootstrap, doc = "xxx")]
#![cfg_attr(debug_assertions, stable(feature = "rust1", since = "1.0.0"))]
Expected output
//! Some docs here
#![cfg_attr(bootstrap, doc = "xxx")]
#![cfg_attr(debug_assertions, stable(feature = "rust1", since = "1.0.0"))]
I see here why rustfmt did this - it thinks that all cfg_attr attributes should be grouped together. But this doesn't make sense in the semantic context of the program: cfg_attr(doc)
is a doc-comment and should be grouped with other doc-comments. See rust-lang/rust#80181 (comment) for a more realistic example.
Is there a way to disable this behavior?
Meta
- rustfmt version: rustfmt 1.4.24-stable (eb894d5 2020-11-05)
- From where did you install rustfmt?: rustup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment