blob: aef26a62e25fba8229ef1df99653976796419d4d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
|
1| |#![allow(unused_assignments, unused_variables)]
2| |
3| 1|fn main() {
4| 1| // Initialize test constants in a way that cannot be determined at compile time, to ensure
5| 1| // rustc and LLVM cannot optimize out statements (or coverage counters) downstream from
6| 1| // dependent conditions.
7| 1| let is_true = std::env::args().len() == 1;
8| 1| let is_false = ! is_true;
9| 1|
10| 1| let mut some_string = Some(String::from("the string content"));
11| 1| println!(
12| 1| "The string or alt: {}"
13| 1| ,
14| 1| some_string
15| 1| .
16| 1| unwrap_or_else
17| 1| (
18| 1| ||
19| | {
20| 0| let mut countdown = 0;
21| 0| if is_false {
22| 0| countdown = 10;
23| 0| }
24| 0| "alt string 1".to_owned()
25| 1| }
26| 1| )
27| 1| );
28| 1|
29| 1| some_string = Some(String::from("the string content"));
30| 1| let
31| 1| a
32| 1| =
33| 1| ||
34| | {
35| 0| let mut countdown = 0;
36| 0| if is_false {
37| 0| countdown = 10;
38| 0| }
39| 0| "alt string 2".to_owned()
40| 1| };
41| 1| println!(
42| 1| "The string or alt: {}"
43| 1| ,
44| 1| some_string
45| 1| .
46| 1| unwrap_or_else
47| 1| (
48| 1| a
49| 1| )
50| 1| );
51| 1|
52| 1| some_string = None;
53| 1| println!(
54| 1| "The string or alt: {}"
55| 1| ,
56| 1| some_string
57| 1| .
58| 1| unwrap_or_else
59| 1| (
60| 1| ||
61| | {
62| 1| let mut countdown = 0;
63| 1| if is_false {
64| 0| countdown = 10;
65| 1| }
66| 1| "alt string 3".to_owned()
67| 1| }
68| 1| )
69| 1| );
70| 1|
71| 1| some_string = None;
72| 1| let
73| 1| a
74| 1| =
75| 1| ||
76| | {
77| 1| let mut countdown = 0;
78| 1| if is_false {
79| 0| countdown = 10;
80| 1| }
81| 1| "alt string 4".to_owned()
82| 1| };
83| 1| println!(
84| 1| "The string or alt: {}"
85| 1| ,
86| 1| some_string
87| 1| .
88| 1| unwrap_or_else
89| 1| (
90| 1| a
91| 1| )
92| 1| );
93| 1|}
|