diff options
| author | pmk21 <prithvikrishna49@gmail.com> | 2020-03-31 15:50:15 +0530 |
|---|---|---|
| committer | pmk21 <prithvikrishna49@gmail.com> | 2020-03-31 15:50:15 +0530 |
| commit | 4cac9786c527bf4f9e14bfc03e8b5adf5cef2b1d (patch) | |
| tree | 43123c35bb8103ae0ccc78e1ee6691ae72f60af2 | |
| parent | 793403a2a8fc5243770f13f8f0f225f5b14a41cd (diff) | |
| download | rust-4cac9786c527bf4f9e14bfc03e8b5adf5cef2b1d.tar.gz rust-4cac9786c527bf4f9e14bfc03e8b5adf5cef2b1d.zip | |
Skip single_match lints in macro rules
| -rw-r--r-- | clippy_lints/src/matches.rs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/clippy_lints/src/matches.rs b/clippy_lints/src/matches.rs index a124bf8b8db..20b793f95de 100644 --- a/clippy_lints/src/matches.rs +++ b/clippy_lints/src/matches.rs @@ -447,6 +447,11 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Matches { #[rustfmt::skip] fn check_single_match(cx: &LateContext<'_, '_>, ex: &Expr<'_>, arms: &[Arm<'_>], expr: &Expr<'_>) { if arms.len() == 2 && arms[0].guard.is_none() && arms[1].guard.is_none() { + if in_macro(expr.span) { + // Don't lint match expressions present in + // macro_rules! block + return; + } if let PatKind::Or(..) = arms[0].pat.kind { // don't lint for or patterns for now, this makes // the lint noisy in unnecessary situations |
