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

Wrapping strategies for function calls #73

Closed
vitiral opened this issue Mar 22, 2017 · 1 comment
Closed

Wrapping strategies for function calls #73

vitiral opened this issue Mar 22, 2017 · 1 comment

Comments

@vitiral
Copy link

vitiral commented Mar 22, 2017

I would like to define the formatting strategy for function calls. It does not currently exist in the style guide

Basic idea

Method 1:

very_long_module_name::this_is_a_really_long_function(arg1,
                                                      arg2,
                                                      arg3,
                                                      "this is a raw s\
                                                       tring and is ter\
                                                       ible")

should instead be Method 2:

very_long_module_name::this_is_a_really_long_function(
    arg1, arg2, arg3, 
    "this is a raw string and is terible")

rustfmt currently uses the Method 1 way too often. I'm not sure the right balance here. Like @joshtriplett said in #47 , you really want to define "simple". IMO "simple" would be:

  • If the function and all args fit within the line length, just do that.
  • Otherwise use Method 1 if Method 1 only takes up two lines
  • Otherwise use Method 2:
    • arguments always start on their own indented line
    • arguments are listed normally as long as they don't go over the line length limit
    • any argument that would go over the line length limit goes on it's own line
    • anything over 25 characters goes on it's own line
@nrc
Copy link
Member

nrc commented Mar 22, 2017

Dup of #65

@nrc nrc mentioned this issue Mar 22, 2017
@nrc nrc closed this as completed Mar 22, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants