summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/tests/ui/needless_return.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:41 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:41 +0000
commit4f9fe856a25ab29345b90e7725509e9ee38a37be (patch)
treee4ffd8a9374cae7b21f7cbfb352927e0e074aff6 /src/tools/clippy/tests/ui/needless_return.rs
parentAdding upstream version 1.68.2+dfsg1. (diff)
downloadrustc-4f9fe856a25ab29345b90e7725509e9ee38a37be.tar.xz
rustc-4f9fe856a25ab29345b90e7725509e9ee38a37be.zip
Adding upstream version 1.69.0+dfsg1.upstream/1.69.0+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--src/tools/clippy/tests/ui/needless_return.rs20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/tools/clippy/tests/ui/needless_return.rs b/src/tools/clippy/tests/ui/needless_return.rs
index abed338bb..a1db8375d 100644
--- a/src/tools/clippy/tests/ui/needless_return.rs
+++ b/src/tools/clippy/tests/ui/needless_return.rs
@@ -31,6 +31,16 @@ fn test_no_semicolon() -> bool {
return true;
}
+#[rustfmt::skip]
+fn test_multiple_semicolon() -> bool {
+ return true;;;
+}
+
+#[rustfmt::skip]
+fn test_multiple_semicolon_with_spaces() -> bool {
+ return true;; ; ;
+}
+
fn test_if_block() -> bool {
if true {
return true;
@@ -297,4 +307,14 @@ fn issue10051() -> Result<String, String> {
}
}
+mod issue10049 {
+ fn single() -> u32 {
+ return if true { 1 } else { 2 };
+ }
+
+ fn multiple(b1: bool, b2: bool, b3: bool) -> u32 {
+ return if b1 { 0 } else { 1 } | if b2 { 2 } else { 3 } | if b3 { 4 } else { 5 };
+ }
+}
+
fn main() {}