]> git.lizzy.rs Git - rust.git/blob - src/tools/rustfmt/tests/source/configs/spaces_around_ranges/true.rs
Add 'src/tools/rustfmt/' from commit '7872306edf2e11a69aaffb9434088fd66b46a863'
[rust.git] / src / tools / rustfmt / tests / source / configs / spaces_around_ranges / true.rs
1 // rustfmt-spaces_around_ranges: true
2 // Spaces around ranges
3
4 fn main() {
5     let lorem = 0..10;
6     let ipsum = 0..=10;
7
8     match lorem {
9         1..5 => foo(),
10         _ => bar,
11     }
12
13     match lorem {
14         1..=5 => foo(),
15         _ => bar,
16     }
17
18     match lorem {
19         1...5 => foo(),
20         _ => bar,
21     }
22 }
23
24 fn half_open() {
25     match [5..4, 99..105, 43..44] {
26         [_, 99.., _] => {}
27         [_, ..105, _] => {}
28         _ => {}
29     };
30
31     if let ..=5 = 0 {}
32     if let ..5 = 0 {}
33     if let 5.. = 0 {}
34 }