summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/tests/ui/semicolon_outside_block.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:13 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:13 +0000
commit218caa410aa38c29984be31a5229b9fa717560ee (patch)
treec54bd55eeb6e4c508940a30e94c0032fbd45d677 /src/tools/clippy/tests/ui/semicolon_outside_block.rs
parentReleasing progress-linux version 1.67.1+dfsg1-1~progress7.99u1. (diff)
downloadrustc-218caa410aa38c29984be31a5229b9fa717560ee.tar.xz
rustc-218caa410aa38c29984be31a5229b9fa717560ee.zip
Merging upstream version 1.68.2+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/tools/clippy/tests/ui/semicolon_outside_block.rs')
-rw-r--r--src/tools/clippy/tests/ui/semicolon_outside_block.rs85
1 files changed, 85 insertions, 0 deletions
diff --git a/src/tools/clippy/tests/ui/semicolon_outside_block.rs b/src/tools/clippy/tests/ui/semicolon_outside_block.rs
new file mode 100644
index 000000000..7ce46431f
--- /dev/null
+++ b/src/tools/clippy/tests/ui/semicolon_outside_block.rs
@@ -0,0 +1,85 @@
+// run-rustfix
+#![allow(
+ unused,
+ clippy::unused_unit,
+ clippy::unnecessary_operation,
+ clippy::no_effect,
+ clippy::single_element_loop
+)]
+#![warn(clippy::semicolon_outside_block)]
+
+macro_rules! m {
+ (()) => {
+ ()
+ };
+ (0) => {{
+ 0
+ };};
+ (1) => {{
+ 1;
+ }};
+ (2) => {{
+ 2;
+ }};
+}
+
+fn unit_fn_block() {
+ ()
+}
+
+#[rustfmt::skip]
+fn main() {
+ { unit_fn_block() }
+ unsafe { unit_fn_block() }
+
+ {
+ unit_fn_block()
+ }
+
+ { unit_fn_block() };
+ unsafe { unit_fn_block() };
+
+ { unit_fn_block(); }
+ unsafe { unit_fn_block(); }
+
+ { unit_fn_block(); };
+ unsafe { unit_fn_block(); };
+
+ {
+ unit_fn_block();
+ unit_fn_block()
+ };
+ {
+ unit_fn_block();
+ unit_fn_block();
+ }
+ {
+ unit_fn_block();
+ unit_fn_block();
+ };
+
+ { m!(()) };
+ { m!(()); }
+ { m!(()); };
+ m!(0);
+ m!(1);
+ m!(2);
+
+ for _ in [()] {
+ unit_fn_block();
+ }
+ for _ in [()] {
+ unit_fn_block()
+ }
+
+ let _d = || {
+ unit_fn_block();
+ };
+ let _d = || {
+ unit_fn_block()
+ };
+
+ { unit_fn_block(); };
+
+ unit_fn_block()
+}