diff options
| author | Samuel Tardieu <sam@rfc1149.net> | 2025-03-18 20:23:40 +0100 |
|---|---|---|
| committer | Samuel Tardieu <sam@rfc1149.net> | 2025-05-21 17:17:30 +0200 |
| commit | e3ec0d2de6b6f764d49fe9150335c9cda7ee5600 (patch) | |
| tree | 0e085cb12c7a1a717bd24403920ed0c9ffe48a44 /clippy_lints/src | |
| parent | 205e313ae4904468d8d2ee6f2cb785bb91271512 (diff) | |
Check MSRV for any entity, not just function and method calls
New Rust releases also stabilize enum variants, constants, and so on. Lint them as well.
Diffstat (limited to 'clippy_lints/src')
| -rw-r--r-- | clippy_lints/src/incompatible_msrv.rs | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/clippy_lints/src/incompatible_msrv.rs b/clippy_lints/src/incompatible_msrv.rs index 1fd8ecd179a..bf165624b43 100644 --- a/clippy_lints/src/incompatible_msrv.rs +++ b/clippy_lints/src/incompatible_msrv.rs @@ -174,14 +174,12 @@ impl<'tcx> LateLintPass<'tcx> for IncompatibleMsrv { self.emit_lint_if_under_msrv(cx, method_did, expr.hir_id, span); } }, - ExprKind::Call(call, _) => { - // Desugaring into function calls by the compiler will use `QPath::LangItem` variants. Those should - // not be linted as they will not be generated in older compilers if the function is not available, - // and the compiler is allowed to call unstable functions. - if let ExprKind::Path(qpath @ (QPath::Resolved(..) | QPath::TypeRelative(..))) = call.kind - && let Some(path_def_id) = cx.qpath_res(&qpath, call.hir_id).opt_def_id() - { - self.emit_lint_if_under_msrv(cx, path_def_id, expr.hir_id, call.span); + // Desugaring into function calls by the compiler will use `QPath::LangItem` variants. Those should + // not be linted as they will not be generated in older compilers if the function is not available, + // and the compiler is allowed to call unstable functions. + ExprKind::Path(qpath @ (QPath::Resolved(..) | QPath::TypeRelative(..))) => { + if let Some(path_def_id) = cx.qpath_res(&qpath, expr.hir_id).opt_def_id() { + self.emit_lint_if_under_msrv(cx, path_def_id, expr.hir_id, expr.span); } }, _ => {}, |
