]> git.lizzy.rs Git - rust.git/blob - src/tools/clippy/tests/ui/crashes/ice-2499.rs
Rollup merge of #71813 - ecstatic-morse:issue-71734, r=tmandry
[rust.git] / src / tools / clippy / tests / ui / crashes / ice-2499.rs
1 // run-pass
2
3 #![allow(dead_code, clippy::char_lit_as_u8, clippy::needless_bool)]
4
5 /// Should not trigger an ICE in `SpanlessHash` / `consts::constant`
6 ///
7 /// Issue: https://github.com/rust-lang/rust-clippy/issues/2499
8
9 fn f(s: &[u8]) -> bool {
10     let t = s[0] as char;
11
12     match t {
13         'E' | 'W' => {},
14         'T' => {
15             if s[0..4] != ['0' as u8; 4] {
16                 return false;
17             } else {
18                 return true;
19             }
20         },
21         _ => {
22             return false;
23         },
24     }
25     true
26 }
27
28 fn main() {}