Skip to content

rustfmt indents leading section comments to match code indentation, breaking intentional left-aligned vertical alignment #6755

@cherishman2005

Description

@cherishman2005

rustfmt indents leading section comments to match code indentation, breaking intentional left-aligned vertical alignment

            .with_quic_config(|mut cfg| {
                // ===== Connection Lifespan =====
                cfg.keep_alive_interval = Duration::from_secs(5);
                cfg.max_idle_timeout = 30_000; // ms (30 seconds)
                // ===== Concurrent Stream Limit (QUIC Layer) =====
                cfg.max_concurrent_stream_limit = 10_000;
                // ===== Flow Control =====
                cfg.max_stream_data = 100 * 1024;
                cfg.max_connection_data = 20 * 1024;
                // ===== Protocol Compatibility =====
                cfg.support_draft_29 = true;
                cfg
            })

After running cargo fmt, the comments are indented to match the surrounding code block:

            .with_quic_config(|mut cfg| {
                // ===== Connection Lifespan =====
                cfg.keep_alive_interval = Duration::from_secs(5);
                cfg.max_idle_timeout = 30_000; // ms (30 seconds)
                                               // ===== Concurrent Stream Limit (QUIC Layer) =====
                cfg.max_concurrent_stream_limit = 100;
                // ===== Flow Control =====
                cfg.max_stream_data = 100 * 1024;
                cfg.max_connection_data = 20 * 1024;
                // ===== Protocol Compatibility =====
                cfg.support_draft_29 = true;
                cfg
            })

// ==== Concurrent Stream Limit (QUIC Layer) ==== is not left-aligned

can you optimize this problem?

Metadata

Metadata

Assignees

No one assigned

    Labels

    S-needs-reproStatus: this issue has no reproduction and needs a reproduction to make progressneeds-triageThis issue or PR needs triaging to determine its status. Remove label once sufficiently triaged.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions