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! {
3838 /// Checks for matches with a single arm where an `if let`
3939 /// will usually suffice.
4040 ///
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+ ///
4146 /// ### Why is this bad?
4247 /// Just readability – `if let` nests less than a `match`.
4348 ///
Original file line number Diff line number Diff line change @@ -237,4 +237,18 @@ mod issue8634 {
237237 } ,
238238 }
239239 }
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+ }
240254}
Original file line number Diff line number Diff line change @@ -295,4 +295,18 @@ mod issue8634 {
295295 } ,
296296 }
297297 }
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+ }
298312}
You can’t perform that action at this time.
0 commit comments