Skip to content

rustfmt removes empty newlines between blocks of module-level attributes #4082

Open
@RalfJung

Description

@RalfJung

In a situation like

#![feature(core_intrinsics)]
#![feature(lang_items)]
#![feature(libc)]
#![feature(nll)]
#![feature(panic_unwind)]
#![feature(staged_api)]
#![feature(std_internals)]
#![feature(unwind_attributes)]
#![feature(abi_thiscall)]
#![feature(rustc_attrs)]
#![feature(raw)]
#![panic_runtime]
#![feature(panic_runtime)]

// `real_imp` is unused with Miri, so silence warnings.
#![cfg_attr(miri, allow(dead_code))]

rustfmt removes that empty line. That's not great, as grouping these attributes by "paragraphs" conveys semantic meaning.

rustfmt preserves empty lines between statements, so it seems like the semantic value of that information is acknowledged, but it is not done consistently.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions