]> git.proxmox.com Git - rustc.git/blob - src/tools/clippy/tests/ui/match_single_binding.stderr
New upstream version 1.52.1+dfsg1
[rustc.git] / src / tools / clippy / tests / ui / match_single_binding.stderr
1 error: this match could be written as a `let` statement
2 --> $DIR/match_single_binding.rs:28:5
3 |
4 LL | / match (a, b, c) {
5 LL | | (x, y, z) => {
6 LL | | println!("{} {} {}", x, y, z);
7 LL | | },
8 LL | | }
9 | |_____^
10 |
11 = note: `-D clippy::match-single-binding` implied by `-D warnings`
12 help: consider using `let` statement
13 |
14 LL | let (x, y, z) = (a, b, c);
15 LL | {
16 LL | println!("{} {} {}", x, y, z);
17 LL | }
18 |
19
20 error: this match could be written as a `let` statement
21 --> $DIR/match_single_binding.rs:34:5
22 |
23 LL | / match (a, b, c) {
24 LL | | (x, y, z) => println!("{} {} {}", x, y, z),
25 LL | | }
26 | |_____^
27 |
28 help: consider using `let` statement
29 |
30 LL | let (x, y, z) = (a, b, c);
31 LL | println!("{} {} {}", x, y, z);
32 |
33
34 error: this match could be replaced by its body itself
35 --> $DIR/match_single_binding.rs:51:5
36 |
37 LL | / match a {
38 LL | | _ => println!("whatever"),
39 LL | | }
40 | |_____^ help: consider using the match body instead: `println!("whatever");`
41
42 error: this match could be replaced by its body itself
43 --> $DIR/match_single_binding.rs:55:5
44 |
45 LL | / match a {
46 LL | | _ => {
47 LL | | let x = 29;
48 LL | | println!("x has a value of {}", x);
49 LL | | },
50 LL | | }
51 | |_____^
52 |
53 help: consider using the match body instead
54 |
55 LL | {
56 LL | let x = 29;
57 LL | println!("x has a value of {}", x);
58 LL | }
59 |
60
61 error: this match could be replaced by its body itself
62 --> $DIR/match_single_binding.rs:62:5
63 |
64 LL | / match a {
65 LL | | _ => {
66 LL | | let e = 5 * a;
67 LL | | if e >= 5 {
68 ... |
69 LL | | },
70 LL | | }
71 | |_____^
72 |
73 help: consider using the match body instead
74 |
75 LL | {
76 LL | let e = 5 * a;
77 LL | if e >= 5 {
78 LL | println!("e is superior to 5");
79 LL | }
80 LL | }
81 |
82
83 error: this match could be written as a `let` statement
84 --> $DIR/match_single_binding.rs:72:5
85 |
86 LL | / match p {
87 LL | | Point { x, y } => println!("Coords: ({}, {})", x, y),
88 LL | | }
89 | |_____^
90 |
91 help: consider using `let` statement
92 |
93 LL | let Point { x, y } = p;
94 LL | println!("Coords: ({}, {})", x, y);
95 |
96
97 error: this match could be written as a `let` statement
98 --> $DIR/match_single_binding.rs:76:5
99 |
100 LL | / match p {
101 LL | | Point { x: x1, y: y1 } => println!("Coords: ({}, {})", x1, y1),
102 LL | | }
103 | |_____^
104 |
105 help: consider using `let` statement
106 |
107 LL | let Point { x: x1, y: y1 } = p;
108 LL | println!("Coords: ({}, {})", x1, y1);
109 |
110
111 error: this match could be written as a `let` statement
112 --> $DIR/match_single_binding.rs:81:5
113 |
114 LL | / match x {
115 LL | | ref r => println!("Got a reference to {}", r),
116 LL | | }
117 | |_____^
118 |
119 help: consider using `let` statement
120 |
121 LL | let ref r = x;
122 LL | println!("Got a reference to {}", r);
123 |
124
125 error: this match could be written as a `let` statement
126 --> $DIR/match_single_binding.rs:86:5
127 |
128 LL | / match x {
129 LL | | ref mut mr => println!("Got a mutable reference to {}", mr),
130 LL | | }
131 | |_____^
132 |
133 help: consider using `let` statement
134 |
135 LL | let ref mut mr = x;
136 LL | println!("Got a mutable reference to {}", mr);
137 |
138
139 error: this match could be written as a `let` statement
140 --> $DIR/match_single_binding.rs:90:5
141 |
142 LL | / let product = match coords() {
143 LL | | Point { x, y } => x * y,
144 LL | | };
145 | |______^
146 |
147 help: consider using `let` statement
148 |
149 LL | let Point { x, y } = coords();
150 LL | let product = x * y;
151 |
152
153 error: this match could be written as a `let` statement
154 --> $DIR/match_single_binding.rs:98:18
155 |
156 LL | .map(|i| match i.unwrap() {
157 | __________________^
158 LL | | unwrapped => unwrapped,
159 LL | | })
160 | |_________^
161 |
162 help: consider using `let` statement
163 |
164 LL | .map(|i| {
165 LL | let unwrapped = i.unwrap();
166 LL | unwrapped
167 LL | })
168 |
169
170 error: this match could be replaced by its body itself
171 --> $DIR/match_single_binding.rs:112:5
172 |
173 LL | / match match y {
174 LL | | 0 => 1,
175 LL | | _ => 2,
176 LL | | } {
177 LL | | _ => println!("Single branch"),
178 LL | | }
179 | |_____^ help: consider using the match body instead: `println!("Single branch");`
180
181 error: aborting due to 12 previous errors
182