rust-lang / rust-lang/rustfmt

Extra whitespace in nested pub extern

Open
#5,525 8 comments 0 reactions 1 assignee View on GitHub

@jmj0502 is already working on this.

Since Sep 2, 2022.

  • #5529 by @jmj0502 — open
A-visibility C-bug I-extraneous-whitespace
Dominant language
Rust
Stars
7k
Forks
1.1k
Avg merge
2d 13h
Merged PRs (30d)
24

Description

The following snippet formats with an extra space between pub and extern "C" if the arguments continue across multiple lines. i.e. rustfmt produces pub␣␣extern "C" instead of pub␣extern "C".

pub struct SomeCallback(
    pub extern "C" fn( 
        long_argument_name_to_avoid_wrap: u32,
        second_long_argument_name: u32,
        third_long_argument_name: u32,
    ),
);

Checked with

  • rustfmt 1.5.1-stable (4b91a6e 2022-08-08) from 1.63.0 stable
  • rustfmt 1.5.1-nightly (c07a8b4 2022-08-26) from a recent nightly

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.