You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
//! 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.
Going to close as a duplicate of #4082. The context here around doc comments is helpful as additional reference cases/motivation, but fundamentally relates to the same lack of support (default or opt-in) for newlines between attrs
Is there a way to disable this behavior?
Not categorically, but #[rustfmt::skip] and/or #[rustfmt::skip::attributes(cfg_attr)]could potentially be of use
Input
Output
Expected output
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
The text was updated successfully, but these errors were encountered: