Skip to content

2.0.0-rc.2 formatting regression with line-wrapped functions #4366

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
ahl opened this issue Aug 6, 2020 · 0 comments · Fixed by #4368
Closed

2.0.0-rc.2 formatting regression with line-wrapped functions #4366

ahl opened this issue Aug 6, 2020 · 0 comments · Fixed by #4368
Assignees
Milestone

Comments

@ahl
Copy link
Contributor

ahl commented Aug 6, 2020

Input

// rustfmt-max_width: 80
trait GetMetadata {
    fn metadata(loc: ApiEndpointParameterLocation)
        -> Vec<ApiEndpointParameter>;
}

Output

// rustfmt-max_width: 80
trait GetMetadata {
    fn metadata(loc: ApiEndpointParameterLocation)
    -> Vec<ApiEndpointParameter>;
}

Expected output

// rustfmt-max_width: 80
trait GetMetadata {
    fn metadata(loc: ApiEndpointParameterLocation)
        -> Vec<ApiEndpointParameter>;
}

Meta

  • rustfmt version: rustfmt 2.0.0-rc.2-nightly (0921e1f 2020-07-29)
  • From where did you install rustfmt?: built from source
@ahl ahl changed the title 2.0.0-rc.2 formatting regression 2.0.0-rc.2 formatting regression with line-wrapped functions Aug 6, 2020
ayazhafiz added a commit to ayazhafiz/rustfmt that referenced this issue Aug 6, 2020
 rust-lang#3891 removed Version One formatting that did this correctly (https://github.com/rust-lang/rustfmt/pull/3891/files#diff-5db152a52bdaeae9dacd35f43a4a78ddL2342-L2344),
but at seemingly at the time there were no tests to catch the
regression.

This commit fix-forwards the formatting regression, though via a different
implementation because the original implementation would muddle the branch
for visual indentation and this fix, which is probably not preferrable
giving the existing complexity of the rewrite_required_fn method.

Closes rust-lang#4366
ayazhafiz added a commit to ayazhafiz/rustfmt that referenced this issue Aug 6, 2020
 rust-lang#3891 removed Version One formatting that did this correctly (https://github.com/rust-lang/rustfmt/pull/3891/files#diff-5db152a52bdaeae9dacd35f43a4a78ddL2342-L2344),
but at seemingly at the time there were no tests to catch the
regression.

This commit fix-forwards the formatting regression, though via a different
implementation because the original implementation would muddle the branch
for visual indentation and this fix, which is probably not preferrable
giving the existing complexity of the rewrite_required_fn method.

Closes rust-lang#4366
ayazhafiz added a commit to ayazhafiz/rustfmt that referenced this issue Aug 6, 2020
 rust-lang#3891 removed Version One formatting that did this correctly (https://github.com/rust-lang/rustfmt/pull/3891/files#diff-5db152a52bdaeae9dacd35f43a4a78ddL2342-L2344),
but at seemingly at the time there were no tests to catch the
regression.

This commit fix-forwards the formatting regression, though via a different
implementation because the original implementation would muddle the branch
for visual indentation and this fix, which is probably not preferrable
giving the existing complexity of the rewrite_required_fn method.

Closes rust-lang#4366
@calebcartwright calebcartwright added this to the 2.0.0 milestone Aug 7, 2020
calebcartwright pushed a commit that referenced this issue Aug 7, 2020
* Indent return types separated from params by newline

 #3891 removed Version One formatting that did this correctly (https://github.com/rust-lang/rustfmt/pull/3891/files#diff-5db152a52bdaeae9dacd35f43a4a78ddL2342-L2344),
but at seemingly at the time there were no tests to catch the
regression.

This commit fix-forwards the formatting regression, though via a different
implementation because the original implementation would muddle the branch
for visual indentation and this fix, which is probably not preferrable
giving the existing complexity of the rewrite_required_fn method.

Closes #4366

* fixup! Indent return types separated from params by newline
ahl added a commit to oxidecomputer/dropshot that referenced this issue Aug 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants