From 0ebd7363b230dc3bf1fb7056831acabf08e36a41 Mon Sep 17 00:00:00 2001 From: Caleb L'Italien Date: Sun, 30 Jun 2024 17:24:26 -0400 Subject: [PATCH] Source code for example from issue #6202 --- tests/source/issue-6202/issue_example.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 tests/source/issue-6202/issue_example.rs diff --git a/tests/source/issue-6202/issue_example.rs b/tests/source/issue-6202/issue_example.rs new file mode 100644 index 00000000000..fab06155d48 --- /dev/null +++ b/tests/source/issue-6202/issue_example.rs @@ -0,0 +1,19 @@ +// rustfmt-max_width: 120 +// rustfmt-comment_width: 100 +// rustfmt-match_block_trailing_comma: true +// rustfmt-wrap_comments: true +// rustfmt-edition: 2021 +// rustfmt-error_on_line_overflow: true +// rustfmt-imports_granularity: Module +// rustfmt-version: Two + +impl EarlyLintPass for NeedlessContinue { + fn check_expr(&mut self, cx: &EarlyContext<'_>, expr: &Expr) { + if let ExprKind::Loop(body, label, ..) | ExprKind::While(_, body, label) | ExprKind::ForLoop { body, label, .. } = + &expr.kind + && !in_external_macro(cx.sess, expr.span) + { + check_final_block_stmt(cx, body, label, expr.span.ctxt()); + } + } +} \ No newline at end of file