rust-lang / rust-lang/rustfmt

Comments on use statements incorrectly rearranged when use statements are rearranged

Open
#3,720 10 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-comments A-imports C-bug
Dominant language
Rust
Stars
7k
Forks
1.1k
Avg merge
2d 13h
Merged PRs (30d)
24

Description

Input:

use c; // use c;
use b; // use b;
use a; // use a;

Expected:

use a; // use a;
use b; // use b;
use c; // use c;

Got:

use a;
use b; // use b;
use c; // use c; // use a;
rustc 1.36.0 (a53f9df32 2019-07-03)
binary: rustc
commit-hash: a53f9df32fbb0b5f4382caaad8f1a46f36ea887c
commit-date: 2019-07-03
host: x86_64-apple-darwin
release: 1.36.0
LLVM version: 8.0

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

Start by reproducing the supplied Rustfmt example and inspecting how use statements and their comments are reordered. Compare the formatter output with the expected output; done means each comment remains attached to its original use statement after sorting.

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
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.