Reinstate single_match/single_match_else lints with comments by samueltardieu · Pull Request #14420 · rust-lang/rust-clippy (original) (raw)

Commit efe3fe9 removed the ability for single_match and single_match_else to trigger if comments were present outside of the arms, as those comments would be lost while rewriting the match expression.

This reinstates the lint, but prevents the suggestion from being applied automatically in the presence of comments by using the MaybeIncorrect applicability. Also, a note is added to the lint message to warn the user about the need to preserve the comments if acting upon the suggestion.

changelog: [single_match, single_match_else]: reinstate lint when comments are inside the match but do not autofix the code

Fix #14418