File tree Expand file tree Collapse file tree 3 files changed +33
-0
lines changed Expand file tree Collapse file tree 3 files changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -38,6 +38,11 @@ declare_clippy_lint! {
38
38
/// Checks for matches with a single arm where an `if let`
39
39
/// will usually suffice.
40
40
///
41
+ /// This intentionally does not lint if there are comments
42
+ /// inside of the other arm, so as to allow the user to document
43
+ /// why having another explicit pattern with an empty body is necessary,
44
+ /// or because the comments need to be preserved for other reasons.
45
+ ///
41
46
/// ### Why is this bad?
42
47
/// Just readability – `if let` nests less than a `match`.
43
48
///
Original file line number Diff line number Diff line change @@ -237,4 +237,18 @@ mod issue8634 {
237
237
},
238
238
}
239
239
}
240
+
241
+ fn block_comment(x: Result<i32, SomeError>) {
242
+ match x {
243
+ Ok(y) => {
244
+ println!("Yay! {y}");
245
+ },
246
+ Err(_) => {
247
+ /*
248
+ let's make sure that this also
249
+ does not lint block comments.
250
+ */
251
+ },
252
+ }
253
+ }
240
254
}
Original file line number Diff line number Diff line change @@ -295,4 +295,18 @@ mod issue8634 {
295
295
} ,
296
296
}
297
297
}
298
+
299
+ fn block_comment ( x : Result < i32 , SomeError > ) {
300
+ match x {
301
+ Ok ( y) => {
302
+ println ! ( "Yay! {y}" ) ;
303
+ } ,
304
+ Err ( _) => {
305
+ /*
306
+ let's make sure that this also
307
+ does not lint block comments.
308
+ */
309
+ } ,
310
+ }
311
+ }
298
312
}
You can’t perform that action at this time.
0 commit comments