-
Notifications
You must be signed in to change notification settings - Fork 900
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
[unstable option] control_brace_style #3377
Comments
Would love to have this feature stabilized. Having |
Does anyone know what's holding this up from being stabilized? Any information would be appreciated. Thank you! |
Is there a reason this still isn't stabilized? |
Why hasn't this been stabilized yet? |
We have a well documented process for stabilizing options and all options are presumed to need to remain unstable unless and until they can easily clear those thresholds, regardless of whether an option is 5 days old or 5 years old. This option isn't stable because that hasn't happened yet, not to mention a bug reported with the still unstable option within the last 24 hours |
Thank you. |
Hi Guys! Is it possible to add an option that AlwaysNextLine would not force the empty _ => {} on the next line?:
Probably we could have an additional flag like for fn_single_line = true? |
Setting either non-default value to So, for instance, using // Expected
let foo = if bar { 0 } else { 1 };
// Actual
let foo = if bar {
0
}
else {
1
} This overrides |
this option still breaks for match arms. |
Edit: added 2nd design idea. I would like to suggest a 4th option: "MultiNextLine". Single line condition: if x < 5 {
println!("Less than 5");
} else {
println("Greater or equal to 5");
} Multi line condition: if vec.iter().find_map(|x| x < 5)
&& let Some(s) = option
{
println!("multiline expr true");
} else {
println("multiline expr false");
} Alternatively, this could be a separate setting altogether: When match control_braces {
AlwaysSameLine => {
// Overrides
if vec.iter().find_map(|x| x < 5)
&& let Some(s) = option
{
println!("multiline expr true");
} else {
println("multiline expr false");
}
}
AlwaysNextLine => {
// Does Nothing
if vec.iter().find_map(|x| x < 5)
&& let Some(s) = option
{
println!("multiline expr true");
}
else
{
println("multiline expr false");
}
}
ClosingNextLine => {
// Overrides top brace only
if vec.iter().find_map(|x| x < 5)
&& let Some(s) = option
{
println!("multiline expr true");
}
else {
println("multiline expr false");
}
}
} If any of these designs are accepted (for experimentation of course), I am willing to contribute a PR implementing it. |
came to this repo to see if something like looks like someone beat me to it! i would also be willing to create a PR for this, if desired. this is honestly the biggest thing i want from rustfmt, and is the main reason i don't use it in personal projects. |
Looking forward to "ClosingNextLine", indented, non-spaced |
iirc, the current behavior of AlwaysSameLine is actually that of the proposed MultiNextLine? idk if this was a recent change? |
Tracking issue for unstable option: control_brace_style
The text was updated successfully, but these errors were encountered: