Skip to content
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

normalize_comments closing brace indentation bug with hard_tabs #3148

Closed
stbuehler opened this issue Oct 28, 2018 · 0 comments · Fixed by #4246
Closed

normalize_comments closing brace indentation bug with hard_tabs #3148

stbuehler opened this issue Oct 28, 2018 · 0 comments · Fixed by #4246
Labels
a-comments only-with-option requires a non-default option value to reproduce poor-formatting

Comments

@stbuehler
Copy link

Hi,

with the following config:

hard_tabs = true
normalize_comments = true

the snippet:

/// ```
/// Data {
///     a: "some text data",
///     ..Default::default()
/// };
/// ```
#[derive(Default)]
pub struct Data {
	a: &str,
	b: u32,
}

gets formatted as:

/// ```
/// Data {
/// 	a: "some text data",
/// 	..Default::default()
/// 	};
/// ```
#[derive(Default)]
pub struct Data {
	a: &str,
	b: u32,
}

Please note the (wrongly) indented closing brace in the doc code block. With hard_tabs = false it works fine.

Tested with rustfmt 0.99.6-nightly (750b252 2018-10-18).

I'd also appreciate it if there was a separate comment_hard_tabs setting (or it simply would always be false), as I think tabs should only be at the beginning of a line, and not within comments - if you're open to it I can open another issue.

stbuehler added a commit to stbuehler/rust-async-dnssd that referenced this issue Oct 28, 2018
- apart from broken comment formatting:
  rust-lang/rustfmt#3148
@nrc nrc added poor-formatting a-comments only-with-option requires a non-default option value to reproduce labels Oct 28, 2018
ayazhafiz added a commit to ayazhafiz/rustfmt that referenced this issue Jun 8, 2020
Adds regression tests for the following issues which seem to be fixed on
master:

Closes rust-lang#1762
Closes rust-lang#2201
Closes rust-lang#2388
Closes rust-lang#2672
Closes rust-lang#2755
Closes rust-lang#2947
Closes rust-lang#2978
Closes rust-lang#3148
Closes rust-lang#3206

@topecongiro @calebcartwright appologies for the large number of issues
in this commit; if you prefer I can split it up into 2+.
ayazhafiz added a commit to ayazhafiz/rustfmt that referenced this issue Jun 9, 2020
Adds regression tests for the following issues which seem to be fixed on
master:

Closes rust-lang#1762
Closes rust-lang#2388
Closes rust-lang#2672
Closes rust-lang#2755
Closes rust-lang#2947
Closes rust-lang#2978
Closes rust-lang#3148
Closes rust-lang#3206

@topecongiro @calebcartwright appologies for the large number of issues
in this commit; if you prefer I can split it up into 2+.
calebcartwright pushed a commit that referenced this issue Jun 9, 2020
* Prune stale issues

Adds regression tests for the following issues which seem to be fixed on
master:

Closes #1762
Closes #2388
Closes #2672
Closes #2755
Closes #2947
Closes #2978
Closes #3148
Closes #3206

@topecongiro @calebcartwright appologies for the large number of issues
in this commit; if you prefer I can split it up into 2+.

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

Successfully merging a pull request may close this issue.

2 participants