Skip to content

Bracing options for modules #1763

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
TimBednarzyk opened this issue Jul 2, 2017 · 2 comments
Closed

Bracing options for modules #1763

TimBednarzyk opened this issue Jul 2, 2017 · 2 comments
Labels
good first issue Issues up for grabs, also good candidates for new rustfmt contributors only-with-option requires a non-default option value to reproduce poor-formatting

Comments

@TimBednarzyk
Copy link

There should be an option to configure the brace style for modules just like control_brace_style, fn_brace_style, and item_brace_style.

Currently, only the following is possible:

#[cfg(test)]
mod tests {
  #[test]
  fn it_works()
  {
  }
}

However, if there was a mod_brace_style then there could be an option for "AlwaysNextLine" which makes the above code look like the following:

#[cfg(test)]
mod tests
{
  #[test]
  fn it_works()
  {
  }
}
@topecongiro topecongiro added the good first issue Issues up for grabs, also good candidates for new rustfmt contributors label Jul 2, 2017
@nrc
Copy link
Member

nrc commented Jul 4, 2017

A module is just an item, so module bracing should be dictated by item_brace_style.

@nrc nrc added only-with-option requires a non-default option value to reproduce poor-formatting labels Jul 4, 2017
@TimBednarzyk
Copy link
Author

This is the contents of the rustfmt.toml that resulted in the former block of code:

control_brace_style = "AlwaysNextLine"
fn_brace_style = "AlwaysNextLine"
item_brace_style = "AlwaysNextLine"
tab_spaces = 2

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 only-with-option requires a non-default option value to reproduce poor-formatting
Projects
None yet
Development

No branches or pull requests

3 participants