]> git.lizzy.rs Git - rust.git/blob - src/tools/clippy/tests/ui/diverging_sub_expression.rs
Rollup merge of #99993 - petrochenkov:linkdated, r=bjorn3
[rust.git] / src / tools / clippy / tests / ui / diverging_sub_expression.rs
1 #![warn(clippy::diverging_sub_expression)]
2 #![allow(clippy::match_same_arms, clippy::overly_complex_bool_expr)]
3 #[allow(clippy::empty_loop)]
4 fn diverge() -> ! {
5     loop {}
6 }
7
8 struct A;
9
10 impl A {
11     fn foo(&self) -> ! {
12         diverge()
13     }
14 }
15
16 #[allow(unused_variables, clippy::unnecessary_operation, clippy::short_circuit_statement)]
17 fn main() {
18     let b = true;
19     b || diverge();
20     b || A.foo();
21 }
22
23 #[allow(dead_code, unused_variables)]
24 fn foobar() {
25     loop {
26         let x = match 5 {
27             4 => return,
28             5 => continue,
29             6 => true || return,
30             7 => true || continue,
31             8 => break,
32             9 => diverge(),
33             3 => true || diverge(),
34             10 => match 42 {
35                 99 => return,
36                 _ => true || panic!("boo"),
37             },
38             _ => true || break,
39         };
40     }
41 }