rust-lang / rust-lang/rustfmt

A comment under struct field exceeds max width

Open
#2,201 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-comments I-max-width
Dominant language
Rust
Stars
7k
Forks
1.1k
Avg merge
2d 13h
Merged PRs (30d)
24

Description

Input
/// Contains data for specific types of import directives.
#[derive(Clone, Debug)]
pub enum ImportDirectiveSubclass<'a> {
    SingleImport {
        target: Ident,
        source: Ident,
        result: PerNS<Cell<Result<&'a NameBinding<'a>, Determinacy>>>,
        type_ns_only: bool,
    },
    GlobImport {
        is_prelude: bool,
        max_vis: Cell<ty::Visibility>, // The visibility of the greatest reexport.
        // n.b. `max_vis` is only used in `finalize_import` to check for reexport errors.
    },
    ExternCrate(Option<Name>),
    MacroUse,
}
Output
/// Contains data for specific types of import directives.
#[derive(Clone, Debug)]
pub enum ImportDirectiveSubclass<'a> {
    SingleImport {
        target: Ident,
        source: Ident,
        result: PerNS<Cell<Result<&'a NameBinding<'a>, Determinacy>>>,
        type_ns_only: bool,
    },
    GlobImport {
        is_prelude: bool,
        max_vis: Cell<ty::Visibility>, // The visibility of the greatest reexport.
                                       // n.b. `max_vis` is only used in `finalize_import` to check for reexport errors.
    },
    ExternCrate(Option<Name>),
    MacroUse,
}
Meta

0.2.16-nightly (4e04e82 2017-11-28)

The above example is taken from https://github.com/rust-lang/rust/blob/90f5cfdfbd3c9e39f897fd2271c7b1c7fdaae58e/src/librustc_resolve/resolve_imports.rs#L37-L53.

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.

Research direction

Reproduce the formatting difference with the Rust snippet in the issue and compare it with the referenced src/librustc_resolve/resolve_imports.rs example. Trace rustfmt's handling of comments under struct fields, then verify that the comment is aligned as shown in the expected output.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
50/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.