diff options
Diffstat (limited to 'src/tools/rustfmt/tests/source/let_else.rs')
| -rw-r--r-- | src/tools/rustfmt/tests/source/let_else.rs | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/tools/rustfmt/tests/source/let_else.rs b/src/tools/rustfmt/tests/source/let_else.rs index 85b3604ad3c..cb2859e805d 100644 --- a/src/tools/rustfmt/tests/source/let_else.rs +++ b/src/tools/rustfmt/tests/source/let_else.rs @@ -160,3 +160,23 @@ fn with_trailing_try_operator() { // Maybe this is a workaround? let Ok(Some(next_bucket)) = ranking_rules[cur_ranking_rule_index].next_bucket(ctx, logger, &ranking_rule_universes[cur_ranking_rule_index]) else { return }; } + +fn issue5901() { + #[cfg(target_os = "linux")] + let Some(x) = foo else { todo!() }; + + #[cfg(target_os = "linux")] + // Some comments between attributes and let-else statement + let Some(x) = foo else { todo!() }; + + #[cfg(target_os = "linux")] + #[cfg(target_arch = "x86_64")] + let Some(x) = foo else { todo!() }; + + // The else block will be multi-lined because attributes and comments before `let` + // are included when calculating max width + #[cfg(target_os = "linux")] + #[cfg(target_arch = "x86_64")] + // Some comments between attributes and let-else statement + let Some(x) = foo() else { todo!() }; +} |
