-
Notifications
You must be signed in to change notification settings - Fork 900
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Changes for #4394 - Support preserving block wrapping of closure bodi…
…es (#4519) * Changes for #4394 - Support preserving block wrapping of closure bodies * Add preserve_closure_block_wrapping config option support * Code purifying based on the discussion in PR #4519 * Further purifying code * Cosmetic comment change
- Loading branch information
1 parent
a96e706
commit 10b95e0
Showing
5 changed files
with
118 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// rustfmt-preserve_closure_block_wrapping: true | ||
|
||
fn main() { | ||
let explicit_conversion_preserves_semantics = | ||
|| { !is_mod || (is_mod && attrs.map_or(true, |a| a.is_empty())) }; | ||
} | ||
|
||
fn main() { | ||
|| {{}}; | ||
} | ||
|
||
fn issue1524() { | ||
let f = |x| {{{{x}}}}; | ||
let f = |x| {{{x}}}; | ||
let f = |x| {{x}}; | ||
let f = |x| {x}; | ||
let f = |x| x; | ||
} | ||
|
||
fn main() { | ||
let arg_test2 = |big_argument_name, test123| {looooooooooooooooooong_function_naaaaaaaaaaaaaaaaame()}; | ||
} | ||
|
||
impl Foo { | ||
pub fn bar(&self) { | ||
Some(SomeType { | ||
push_closure_out_to_100_chars: iter(otherwise_it_works_ok.into_iter().map(|f| { | ||
Ok(f) | ||
})), | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// rustfmt-preserve_closure_block_wrapping: true | ||
|
||
fn main() { | ||
let explicit_conversion_preserves_semantics = | ||
|| { !is_mod || (is_mod && attrs.map_or(true, |a| a.is_empty())) }; | ||
} | ||
|
||
fn main() { | ||
|| { {} }; | ||
} | ||
|
||
fn issue1524() { | ||
let f = |x| { | ||
{ | ||
{ | ||
{ x } | ||
} | ||
} | ||
}; | ||
let f = |x| { | ||
{ | ||
{ x } | ||
} | ||
}; | ||
let f = |x| { | ||
{ x } | ||
}; | ||
let f = |x| { x }; | ||
let f = |x| x; | ||
} | ||
|
||
fn main() { | ||
let arg_test2 = | ||
|big_argument_name, test123| { looooooooooooooooooong_function_naaaaaaaaaaaaaaaaame() }; | ||
} | ||
|
||
impl Foo { | ||
pub fn bar(&self) { | ||
Some(SomeType { | ||
push_closure_out_to_100_chars: iter( | ||
otherwise_it_works_ok.into_iter().map(|f| { Ok(f) }), | ||
), | ||
}) | ||
} | ||
} |