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

if in match arm should have multi-line formatting like an if expression #1099

Closed
nrc opened this issue Jul 15, 2016 · 2 comments
Closed

if in match arm should have multi-line formatting like an if expression #1099

nrc opened this issue Jul 15, 2016 · 2 comments
Labels
good first issue Issues up for grabs, also good candidates for new rustfmt contributors

Comments

@nrc
Copy link
Member

nrc commented Jul 15, 2016

I.e., if a condition spans multiple lines, the lines should be aligned. E.g.,

                ItemKind::Enum(_, Generics { ref ty_params, .. })
-                    if ty_params.is_empty() &&
-                    attr::contains_name(&annitem.attrs, "derive_Copy") => {
+                    if ty_params.is_empty()
+                       && attr::contains_name(&annitem.attrs, "derive_Copy") => {

Whilst I've labelled this easy, it is probably good as a second bug, rather than a first.

@nrc nrc added the good first issue Issues up for grabs, also good candidates for new rustfmt contributors label Jul 15, 2016
@bekh6ex
Copy link
Contributor

bekh6ex commented Nov 12, 2016

Currently I'm getting this behaviour:

 fn f() -> () {⏎
     match a {⏎
-        ItemKind::Enum(_, Generics { ref ty_params, .. }) ⏎
-          if ty_params.is_empty() && ⏎
-            ty_params.is_empty() ⏎
-        && ty_params.is_empty() ⏎
-    && attr::contains_name(&annitem.attrs, "derive_Copy") => { asd }⏎
+        ItemKind::Enum(_, Generics { ref ty_params, .. })⏎
+            if ty_params.is_empty() && ty_params.is_empty() && ty_params.is_empty() &&⏎
+               attr::contains_name(&annitem.attrs, "derive_Copy") => asd,⏎
     }⏎
 }⏎

Seems like conditions are aligned. Shouldn't issue be closed?

@nrc
Copy link
Member Author

nrc commented Nov 13, 2016

Sounds like we just need to add a test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Issues up for grabs, also good candidates for new rustfmt contributors
Projects
None yet
Development

No branches or pull requests

3 participants