about summary refs log tree commit diff
path: root/tests/codegen/issues/issue-73396-bounds-check-after-position.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/codegen/issues/issue-73396-bounds-check-after-position.rs')
-rw-r--r--tests/codegen/issues/issue-73396-bounds-check-after-position.rs36
1 files changed, 6 insertions, 30 deletions
diff --git a/tests/codegen/issues/issue-73396-bounds-check-after-position.rs b/tests/codegen/issues/issue-73396-bounds-check-after-position.rs
index ef4538ac84e..9b3b1318ced 100644
--- a/tests/codegen/issues/issue-73396-bounds-check-after-position.rs
+++ b/tests/codegen/issues/issue-73396-bounds-check-after-position.rs
@@ -12,11 +12,7 @@ pub fn position_slice_to_no_bounds_check(s: &[u8]) -> &[u8] {
     // CHECK-NOT: slice_end_index_len_fail
     // CHECK-NOT: panic_bounds_check
     // CHECK-NOT: unreachable
-    if let Some(idx) = s.iter().position(|b| *b == b'\\') {
-        &s[..idx]
-    } else {
-        s
-    }
+    if let Some(idx) = s.iter().position(|b| *b == b'\\') { &s[..idx] } else { s }
 }
 
 // CHECK-LABEL: @position_slice_from_no_bounds_check
@@ -27,11 +23,7 @@ pub fn position_slice_from_no_bounds_check(s: &[u8]) -> &[u8] {
     // CHECK-NOT: slice_end_index_len_fail
     // CHECK-NOT: panic_bounds_check
     // CHECK-NOT: unreachable
-    if let Some(idx) = s.iter().position(|b| *b == b'\\') {
-        &s[idx..]
-    } else {
-        s
-    }
+    if let Some(idx) = s.iter().position(|b| *b == b'\\') { &s[idx..] } else { s }
 }
 
 // CHECK-LABEL: @position_index_no_bounds_check
@@ -42,11 +34,7 @@ pub fn position_index_no_bounds_check(s: &[u8]) -> u8 {
     // CHECK-NOT: slice_end_index_len_fail
     // CHECK-NOT: panic_bounds_check
     // CHECK-NOT: unreachable
-    if let Some(idx) = s.iter().position(|b| *b == b'\\') {
-        s[idx]
-    } else {
-        42
-    }
+    if let Some(idx) = s.iter().position(|b| *b == b'\\') { s[idx] } else { 42 }
 }
 // CHECK-LABEL: @rposition_slice_to_no_bounds_check
 #[no_mangle]
@@ -56,11 +44,7 @@ pub fn rposition_slice_to_no_bounds_check(s: &[u8]) -> &[u8] {
     // CHECK-NOT: slice_end_index_len_fail
     // CHECK-NOT: panic_bounds_check
     // CHECK-NOT: unreachable
-    if let Some(idx) = s.iter().rposition(|b| *b == b'\\') {
-        &s[..idx]
-    } else {
-        s
-    }
+    if let Some(idx) = s.iter().rposition(|b| *b == b'\\') { &s[..idx] } else { s }
 }
 
 // CHECK-LABEL: @rposition_slice_from_no_bounds_check
@@ -71,11 +55,7 @@ pub fn rposition_slice_from_no_bounds_check(s: &[u8]) -> &[u8] {
     // CHECK-NOT: slice_end_index_len_fail
     // CHECK-NOT: panic_bounds_check
     // CHECK-NOT: unreachable
-    if let Some(idx) = s.iter().rposition(|b| *b == b'\\') {
-        &s[idx..]
-    } else {
-        s
-    }
+    if let Some(idx) = s.iter().rposition(|b| *b == b'\\') { &s[idx..] } else { s }
 }
 
 // CHECK-LABEL: @rposition_index_no_bounds_check
@@ -86,9 +66,5 @@ pub fn rposition_index_no_bounds_check(s: &[u8]) -> u8 {
     // CHECK-NOT: slice_end_index_len_fail
     // CHECK-NOT: panic_bounds_check
     // CHECK-NOT: unreachable
-    if let Some(idx) = s.iter().rposition(|b| *b == b'\\') {
-        s[idx]
-    } else {
-        42
-    }
+    if let Some(idx) = s.iter().rposition(|b| *b == b'\\') { s[idx] } else { 42 }
 }