diff options
| author | bors <bors@rust-lang.org> | 2021-07-29 09:35:13 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2021-07-29 09:35:13 +0000 |
| commit | 766f09f5c12e9103eb78da583eb637d036bdf795 (patch) | |
| tree | 290e84a18e223b7efdf4a142f4ef19d5a6b626d5 /clippy_lints | |
| parent | 92ca25b3ec8cef291f1d3b37bfd01d3cce8609e2 (diff) | |
| parent | 80116f9009976396d2f821ceeda107ce6b851830 (diff) | |
| download | rust-766f09f5c12e9103eb78da583eb637d036bdf795.tar.gz rust-766f09f5c12e9103eb78da583eb637d036bdf795.zip | |
Auto merge of #7503 - flip1995:rustup, r=flip1995
Rustup r? `@ghost` changelog: none
Diffstat (limited to 'clippy_lints')
| -rw-r--r-- | clippy_lints/Cargo.toml | 2 | ||||
| -rw-r--r-- | clippy_lints/src/implicit_hasher.rs | 10 | ||||
| -rw-r--r-- | clippy_lints/src/missing_doc.rs | 2 | ||||
| -rw-r--r-- | clippy_lints/src/types/type_complexity.rs | 7 | ||||
| -rw-r--r-- | clippy_lints/src/use_self.rs | 7 |
5 files changed, 23 insertions, 5 deletions
diff --git a/clippy_lints/Cargo.toml b/clippy_lints/Cargo.toml index 42cf7547f51..0aa5b297442 100644 --- a/clippy_lints/Cargo.toml +++ b/clippy_lints/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "clippy_lints" # begin automatic update -version = "0.1.55" +version = "0.1.56" # end automatic update authors = ["The Rust Clippy Developers"] description = "A bunch of helpful lints to avoid common pitfalls in Rust" diff --git a/clippy_lints/src/implicit_hasher.rs b/clippy_lints/src/implicit_hasher.rs index aae44f64e66..fcc43cce6ce 100644 --- a/clippy_lints/src/implicit_hasher.rs +++ b/clippy_lints/src/implicit_hasher.rs @@ -3,7 +3,7 @@ use std::collections::BTreeMap; use rustc_errors::DiagnosticBuilder; use rustc_hir as hir; -use rustc_hir::intravisit::{walk_body, walk_expr, walk_ty, NestedVisitorMap, Visitor}; +use rustc_hir::intravisit::{walk_body, walk_expr, walk_inf, walk_ty, NestedVisitorMap, Visitor}; use rustc_hir::{Body, Expr, ExprKind, GenericArg, Item, ItemKind, QPath, TyKind}; use rustc_lint::{LateContext, LateLintPass, LintContext}; use rustc_middle::hir::map::Map; @@ -295,6 +295,14 @@ impl<'a, 'tcx> Visitor<'tcx> for ImplicitHasherTypeVisitor<'a, 'tcx> { walk_ty(self, t); } + fn visit_infer(&mut self, inf: &'tcx hir::InferArg) { + if let Some(target) = ImplicitHasherType::new(self.cx, &inf.to_ty()) { + self.found.push(target); + } + + walk_inf(self, inf); + } + fn nested_visit_map(&mut self) -> NestedVisitorMap<Self::Map> { NestedVisitorMap::None } diff --git a/clippy_lints/src/missing_doc.rs b/clippy_lints/src/missing_doc.rs index aeed8268902..8f5aeae85df 100644 --- a/clippy_lints/src/missing_doc.rs +++ b/clippy_lints/src/missing_doc.rs @@ -121,7 +121,7 @@ impl<'tcx> LateLintPass<'tcx> for MissingDoc { fn check_crate(&mut self, cx: &LateContext<'tcx>, krate: &'tcx hir::Crate<'_>) { let attrs = cx.tcx.hir().attrs(hir::CRATE_HIR_ID); - self.check_missing_docs_attrs(cx, attrs, krate.item.inner, "the", "crate"); + self.check_missing_docs_attrs(cx, attrs, krate.module().inner, "the", "crate"); } fn check_item(&mut self, cx: &LateContext<'tcx>, it: &'tcx hir::Item<'_>) { diff --git a/clippy_lints/src/types/type_complexity.rs b/clippy_lints/src/types/type_complexity.rs index d8c4b67520d..20c136407a1 100644 --- a/clippy_lints/src/types/type_complexity.rs +++ b/clippy_lints/src/types/type_complexity.rs @@ -1,6 +1,6 @@ use clippy_utils::diagnostics::span_lint; use rustc_hir as hir; -use rustc_hir::intravisit::{walk_ty, NestedVisitorMap, Visitor}; +use rustc_hir::intravisit::{walk_inf, walk_ty, NestedVisitorMap, Visitor}; use rustc_hir::{GenericParamKind, TyKind}; use rustc_lint::LateContext; use rustc_middle::hir::map::Map; @@ -39,6 +39,11 @@ struct TypeComplexityVisitor { impl<'tcx> Visitor<'tcx> for TypeComplexityVisitor { type Map = Map<'tcx>; + fn visit_infer(&mut self, inf: &'tcx hir::InferArg) { + self.score += 1; + walk_inf(self, inf); + } + fn visit_ty(&mut self, ty: &'tcx hir::Ty<'_>) { let (add_score, sub_nest) = match ty.kind { // _, &x and *x have only small overhead; don't mess with nesting level diff --git a/clippy_lints/src/use_self.rs b/clippy_lints/src/use_self.rs index fbd552186df..a3601cca2ef 100644 --- a/clippy_lints/src/use_self.rs +++ b/clippy_lints/src/use_self.rs @@ -8,7 +8,7 @@ use rustc_hir::{ self as hir, def::{CtorOf, DefKind, Res}, def_id::LocalDefId, - intravisit::{walk_ty, NestedVisitorMap, Visitor}, + intravisit::{walk_inf, walk_ty, NestedVisitorMap, Visitor}, Expr, ExprKind, FnRetTy, FnSig, GenericArg, HirId, Impl, ImplItemKind, Item, ItemKind, Path, QPath, TyKind, }; use rustc_lint::{LateContext, LateLintPass, LintContext}; @@ -264,6 +264,11 @@ struct SkipTyCollector { impl<'tcx> Visitor<'tcx> for SkipTyCollector { type Map = Map<'tcx>; + fn visit_infer(&mut self, inf: &hir::InferArg) { + self.types_to_skip.push(inf.hir_id); + + walk_inf(self, inf); + } fn visit_ty(&mut self, hir_ty: &hir::Ty<'_>) { self.types_to_skip.push(hir_ty.hir_id); |
