Skip to content

rustfmt inserts newline between comment and use when both reorder_imports and reorder_imports_in_group is set to true #1789

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
topecongiro opened this issue Jul 14, 2017 · 2 comments
Labels
a-comments duplicate only-with-option requires a non-default option value to reproduce p-high poor-formatting

Comments

@topecongiro
Copy link
Contributor

rustfmt.toml

reorder_imports = true
reorder_imports_in_group = true

input

// cmp
use std::cmp;
use std::cmp::{max, min, Ordering};

output

// cmp

use std::cmp;
use std::cmp::{max, min, Ordering};
@topecongiro topecongiro added a-comments only-with-option requires a non-default option value to reproduce poor-formatting labels Jul 14, 2017
@topecongiro
Copy link
Contributor Author

Should reorder_imports_in_group regard comment as a separator?
For example, when given the following snippet,

use std::cmp::{max, min, Ordering};
// cmp
use std::cmp;

which output should we use?

  1. Consider comment as a part of the following use and move the comment with it
// cmp
use std::cmp;
use std::cmp::{max, min, Ordering};
  1. Consider comment as a separator
use std::cmp::{max, min, Ordering};
// cmp
use std::cmp;

@topecongiro
Copy link
Contributor Author

Closing since this was a dup of #1373.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a-comments duplicate only-with-option requires a non-default option value to reproduce p-high poor-formatting
Projects
None yet
Development

No branches or pull requests

1 participant