Auto merge of #4938 - flip1995:rustup, r=flip1995

Rustup to rust-lang/rust#66931

changelog: none
This commit is contained in:
bors 2019-12-22 14:58:55 +00:00
commit 6d12259811
46 changed files with 117 additions and 117 deletions

View File

@ -113,7 +113,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Arithmetic {
}
}
fn check_body(&mut self, cx: &LateContext<'_, '_>, body: &hir::Body) {
fn check_body(&mut self, cx: &LateContext<'_, '_>, body: &hir::Body<'_>) {
let body_owner = cx.tcx.hir().body_owner(body.id());
match cx.tcx.hir().body_owner_kind(body_owner) {
@ -131,7 +131,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Arithmetic {
}
}
fn check_body_post(&mut self, cx: &LateContext<'_, '_>, body: &hir::Body) {
fn check_body_post(&mut self, cx: &LateContext<'_, '_>, body: &hir::Body<'_>) {
let body_owner = cx.tcx.hir().body_owner(body.id());
let body_span = cx.tcx.hir().span(body_owner);

View File

@ -224,7 +224,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Attributes {
}
}
fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx Item) {
fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx Item<'_>) {
if is_relevant_item(cx, item) {
check_attrs(cx, item.span, item.ident.name, &item.attrs)
}
@ -232,7 +232,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Attributes {
ItemKind::ExternCrate(..) | ItemKind::Use(..) => {
let skip_unused_imports = item.attrs.iter().any(|attr| attr.check_name(sym!(macro_use)));
for attr in &item.attrs {
for attr in item.attrs {
if in_external_macro(cx.sess(), attr.span) {
return;
}
@ -295,13 +295,13 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Attributes {
}
}
fn check_impl_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx ImplItem) {
fn check_impl_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx ImplItem<'_>) {
if is_relevant_impl(cx, item) {
check_attrs(cx, item.span, item.ident.name, &item.attrs)
}
}
fn check_trait_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx TraitItem) {
fn check_trait_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx TraitItem<'_>) {
if is_relevant_trait(cx, item) {
check_attrs(cx, item.span, item.ident.name, &item.attrs)
}
@ -355,7 +355,7 @@ fn check_clippy_lint_names(cx: &LateContext<'_, '_>, items: &[NestedMetaItem]) {
}
}
fn is_relevant_item(cx: &LateContext<'_, '_>, item: &Item) -> bool {
fn is_relevant_item(cx: &LateContext<'_, '_>, item: &Item<'_>) -> bool {
if let ItemKind::Fn(_, _, eid) = item.kind {
is_relevant_expr(cx, cx.tcx.body_tables(eid), &cx.tcx.hir().body(eid).value)
} else {
@ -363,14 +363,14 @@ fn is_relevant_item(cx: &LateContext<'_, '_>, item: &Item) -> bool {
}
}
fn is_relevant_impl(cx: &LateContext<'_, '_>, item: &ImplItem) -> bool {
fn is_relevant_impl(cx: &LateContext<'_, '_>, item: &ImplItem<'_>) -> bool {
match item.kind {
ImplItemKind::Method(_, eid) => is_relevant_expr(cx, cx.tcx.body_tables(eid), &cx.tcx.hir().body(eid).value),
_ => false,
}
}
fn is_relevant_trait(cx: &LateContext<'_, '_>, item: &TraitItem) -> bool {
fn is_relevant_trait(cx: &LateContext<'_, '_>, item: &TraitItem<'_>) -> bool {
match item.kind {
TraitItemKind::Method(_, TraitMethod::Required(_)) => true,
TraitItemKind::Method(_, TraitMethod::Provided(eid)) => {

View File

@ -61,7 +61,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NonminimalBool {
cx: &LateContext<'a, 'tcx>,
_: intravisit::FnKind<'tcx>,
_: &'tcx FnDecl,
body: &'tcx Body,
body: &'tcx Body<'_>,
_: Span,
_: HirId,
) {

View File

@ -48,7 +48,7 @@ impl CognitiveComplexity {
cx: &'a LateContext<'a, 'tcx>,
kind: FnKind<'tcx>,
decl: &'tcx FnDecl,
body: &'tcx Body,
body: &'tcx Body<'_>,
body_span: Span,
) {
if body_span.from_expansion() {
@ -117,7 +117,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for CognitiveComplexity {
cx: &LateContext<'a, 'tcx>,
kind: FnKind<'tcx>,
decl: &'tcx FnDecl,
body: &'tcx Body,
body: &'tcx Body<'_>,
span: Span,
hir_id: HirId,
) {

View File

@ -33,7 +33,7 @@ declare_clippy_lint! {
declare_lint_pass!(CopyIterator => [COPY_ITERATOR]);
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for CopyIterator {
fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx Item) {
fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx Item<'_>) {
if let ItemKind::Impl(_, _, _, _, Some(ref trait_ref), _, _) = item.kind {
let ty = cx.tcx.type_of(cx.tcx.hir().local_def_id(item.hir_id));

View File

@ -66,7 +66,7 @@ declare_clippy_lint! {
declare_lint_pass!(Derive => [EXPL_IMPL_CLONE_ON_COPY, DERIVE_HASH_XOR_EQ]);
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Derive {
fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx Item) {
fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx Item<'_>) {
if let ItemKind::Impl(_, _, _, _, Some(ref trait_ref), _, _) = item.kind {
let ty = cx.tcx.type_of(cx.tcx.hir().local_def_id(item.hir_id));
let is_automatically_derived = is_automatically_derived(&*item.attrs);
@ -130,7 +130,7 @@ fn check_hash_peq<'a, 'tcx>(
}
/// Implementation of the `EXPL_IMPL_CLONE_ON_COPY` lint.
fn check_copy_clone<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, item: &Item, trait_ref: &TraitRef, ty: Ty<'tcx>) {
fn check_copy_clone<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, item: &Item<'_>, trait_ref: &TraitRef, ty: Ty<'tcx>) {
if match_path(&trait_ref.path, &paths::CLONE_TRAIT) {
if !is_copy(cx, ty) {
return;

View File

@ -146,11 +146,11 @@ impl DocMarkdown {
impl_lint_pass!(DocMarkdown => [DOC_MARKDOWN, MISSING_SAFETY_DOC, MISSING_ERRORS_DOC, NEEDLESS_DOCTEST_MAIN]);
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for DocMarkdown {
fn check_crate(&mut self, cx: &LateContext<'a, 'tcx>, krate: &'tcx hir::Crate) {
fn check_crate(&mut self, cx: &LateContext<'a, 'tcx>, krate: &'tcx hir::Crate<'_>) {
check_attrs(cx, &self.valid_idents, &krate.attrs);
}
fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx hir::Item) {
fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx hir::Item<'_>) {
let headers = check_attrs(cx, &self.valid_idents, &item.attrs);
match item.kind {
hir::ItemKind::Fn(ref sig, ..) => {
@ -163,20 +163,20 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for DocMarkdown {
}
}
fn check_item_post(&mut self, _cx: &LateContext<'a, 'tcx>, item: &'tcx hir::Item) {
fn check_item_post(&mut self, _cx: &LateContext<'a, 'tcx>, item: &'tcx hir::Item<'_>) {
if let hir::ItemKind::Impl(..) = item.kind {
self.in_trait_impl = false;
}
}
fn check_trait_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx hir::TraitItem) {
fn check_trait_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx hir::TraitItem<'_>) {
let headers = check_attrs(cx, &self.valid_idents, &item.attrs);
if let hir::TraitItemKind::Method(ref sig, ..) = item.kind {
lint_for_missing_headers(cx, item.hir_id, item.span, sig, headers);
}
}
fn check_impl_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx hir::ImplItem) {
fn check_impl_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx hir::ImplItem<'_>) {
let headers = check_attrs(cx, &self.valid_idents, &item.attrs);
if self.in_trait_impl {
return;

View File

@ -27,7 +27,7 @@ declare_clippy_lint! {
declare_lint_pass!(EmptyEnum => [EMPTY_ENUM]);
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for EmptyEnum {
fn check_item(&mut self, cx: &LateContext<'_, '_>, item: &Item) {
fn check_item(&mut self, cx: &LateContext<'_, '_>, item: &Item<'_>) {
let did = cx.tcx.hir().local_def_id(item.hir_id);
if let ItemKind::Enum(..) = item.kind {
let ty = cx.tcx.type_of(did);

View File

@ -41,12 +41,12 @@ declare_lint_pass!(UnportableVariant => [ENUM_CLIKE_UNPORTABLE_VARIANT]);
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnportableVariant {
#[allow(clippy::cast_possible_truncation, clippy::cast_possible_wrap, clippy::cast_sign_loss)]
fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx Item) {
fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx Item<'_>) {
if cx.tcx.data_layout.pointer_size.bits() != 64 {
return;
}
if let ItemKind::Enum(def, _) = &item.kind {
for var in &def.variants {
for var in def.variants {
if let Some(anon_const) = &var.disr_expr {
let param_env = ty::ParamEnv::empty();
let def_id = cx.tcx.hir().body_owner_def_id(anon_const.body);

View File

@ -29,16 +29,16 @@ declare_clippy_lint! {
declare_lint_pass!(EnumGlobUse => [ENUM_GLOB_USE]);
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for EnumGlobUse {
fn check_mod(&mut self, cx: &LateContext<'a, 'tcx>, m: &'tcx Mod, _: Span, _: HirId) {
fn check_mod(&mut self, cx: &LateContext<'a, 'tcx>, m: &'tcx Mod<'_>, _: Span, _: HirId) {
let map = cx.tcx.hir();
// only check top level `use` statements
for item in &m.item_ids {
for item in m.item_ids {
lint_item(cx, map.expect_item(item.id));
}
}
}
fn lint_item(cx: &LateContext<'_, '_>, item: &Item) {
fn lint_item(cx: &LateContext<'_, '_>, item: &Item<'_>) {
if item.vis.node.is_pub() {
return; // re-exports are fine
}

View File

@ -56,7 +56,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for BoxedLocal {
cx: &LateContext<'a, 'tcx>,
_: visit::FnKind<'tcx>,
_: &'tcx FnDecl,
body: &'tcx Body,
body: &'tcx Body<'_>,
_: Span,
hir_id: HirId,
) {

View File

@ -32,11 +32,11 @@ declare_clippy_lint! {
declare_lint_pass!(FallibleImplFrom => [FALLIBLE_IMPL_FROM]);
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for FallibleImplFrom {
fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx hir::Item) {
fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx hir::Item<'_>) {
// check for `impl From<???> for ..`
let impl_def_id = cx.tcx.hir().local_def_id(item.hir_id);
if_chain! {
if let hir::ItemKind::Impl(.., ref impl_items) = item.kind;
if let hir::ItemKind::Impl(.., impl_items) = item.kind;
if let Some(impl_trait_ref) = cx.tcx.impl_trait_ref(impl_def_id);
if match_def_path(cx, impl_trait_ref.def_id, &FROM_TRAIT);
then {
@ -46,7 +46,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for FallibleImplFrom {
}
}
fn lint_impl_body<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, impl_span: Span, impl_items: &hir::HirVec<hir::ImplItemRef>) {
fn lint_impl_body<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, impl_span: Span, impl_items: &[hir::ImplItemRef]) {
use rustc::hir::intravisit::{self, NestedVisitorMap, Visitor};
use rustc::hir::*;

View File

@ -187,7 +187,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Functions {
cx: &LateContext<'a, 'tcx>,
kind: intravisit::FnKind<'tcx>,
decl: &'tcx hir::FnDecl,
body: &'tcx hir::Body,
body: &'tcx hir::Body<'_>,
span: Span,
hir_id: hir::HirId,
) {
@ -227,7 +227,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Functions {
self.check_line_number(cx, span, body);
}
fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx hir::Item) {
fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx hir::Item<'_>) {
let attr = must_use_attr(&item.attrs);
if let hir::ItemKind::Fn(ref sig, ref _generics, ref body_id) = item.kind {
if let Some(attr) = attr {
@ -249,7 +249,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Functions {
}
}
fn check_impl_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx hir::ImplItem) {
fn check_impl_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx hir::ImplItem<'_>) {
if let hir::ImplItemKind::Method(ref sig, ref body_id) = item.kind {
let attr = must_use_attr(&item.attrs);
if let Some(attr) = attr {
@ -272,7 +272,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Functions {
}
}
fn check_trait_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx hir::TraitItem) {
fn check_trait_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx hir::TraitItem<'_>) {
if let hir::TraitItemKind::Method(ref sig, ref eid) = item.kind {
// don't lint extern functions decls, it's not their fault
if sig.header.abi == Abi::Rust {
@ -317,7 +317,7 @@ impl<'a, 'tcx> Functions {
}
}
fn check_line_number(self, cx: &LateContext<'_, '_>, span: Span, body: &'tcx hir::Body) {
fn check_line_number(self, cx: &LateContext<'_, '_>, span: Span, body: &'tcx hir::Body<'_>) {
if in_external_macro(cx.sess(), span) {
return;
}
@ -375,7 +375,7 @@ impl<'a, 'tcx> Functions {
cx: &LateContext<'a, 'tcx>,
unsafety: hir::Unsafety,
decl: &'tcx hir::FnDecl,
body: &'tcx hir::Body,
body: &'tcx hir::Body<'_>,
hir_id: hir::HirId,
) {
let expr = &body.value;
@ -439,7 +439,7 @@ fn check_needless_must_use(
fn check_must_use_candidate<'a, 'tcx>(
cx: &LateContext<'a, 'tcx>,
decl: &'tcx hir::FnDecl,
body: &'tcx hir::Body,
body: &'tcx hir::Body<'_>,
item_span: Span,
item_id: hir::HirId,
fn_span: Span,
@ -521,7 +521,7 @@ fn is_must_use_ty<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, ty: Ty<'tcx>) -> bool {
}
}
fn has_mutable_arg(cx: &LateContext<'_, '_>, body: &hir::Body) -> bool {
fn has_mutable_arg(cx: &LateContext<'_, '_>, body: &hir::Body<'_>) -> bool {
let mut tys = FxHashSet::default();
body.params.iter().any(|param| is_mutable_pat(cx, &param.pat, &mut tys))
}
@ -686,7 +686,7 @@ fn is_mutated_static(cx: &LateContext<'_, '_>, e: &hir::Expr) -> bool {
}
}
fn mutates_static<'a, 'tcx>(cx: &'a LateContext<'a, 'tcx>, body: &'tcx hir::Body) -> bool {
fn mutates_static<'a, 'tcx>(cx: &'a LateContext<'a, 'tcx>, body: &'tcx hir::Body<'_>) -> bool {
let mut v = StaticMutVisitor {
cx,
mutates_static: false,

View File

@ -130,7 +130,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for ImplicitReturn {
cx: &LateContext<'a, 'tcx>,
_: FnKind<'tcx>,
_: &'tcx FnDecl,
body: &'tcx Body,
body: &'tcx Body<'_>,
span: Span,
_: HirId,
) {

View File

@ -49,7 +49,7 @@ pub struct MultipleInherentImpl {
impl_lint_pass!(MultipleInherentImpl => [MULTIPLE_INHERENT_IMPL]);
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MultipleInherentImpl {
fn check_item(&mut self, _: &LateContext<'a, 'tcx>, item: &'tcx Item) {
fn check_item(&mut self, _: &LateContext<'a, 'tcx>, item: &'tcx Item<'_>) {
if let ItemKind::Impl(_, _, _, ref generics, None, _, _) = item.kind {
// Remember for each inherent implementation encoutered its span and generics
// but filter out implementations that have generic params (type or lifetime)
@ -60,7 +60,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MultipleInherentImpl {
}
}
fn check_crate_post(&mut self, cx: &LateContext<'a, 'tcx>, krate: &'tcx Crate) {
fn check_crate_post(&mut self, cx: &LateContext<'a, 'tcx>, krate: &'tcx Crate<'_>) {
if let Some(item) = krate.items.values().nth(0) {
// Retrieve all inherent implementations from the crate, grouped by type
for impls in cx

View File

@ -94,7 +94,7 @@ declare_clippy_lint! {
declare_lint_pass!(InherentToString => [INHERENT_TO_STRING, INHERENT_TO_STRING_SHADOW_DISPLAY]);
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for InherentToString {
fn check_impl_item(&mut self, cx: &LateContext<'a, 'tcx>, impl_item: &'tcx ImplItem) {
fn check_impl_item(&mut self, cx: &LateContext<'a, 'tcx>, impl_item: &'tcx ImplItem<'_>) {
if impl_item.span.from_expansion() {
return;
}
@ -120,7 +120,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for InherentToString {
}
}
fn show_lint(cx: &LateContext<'_, '_>, item: &ImplItem) {
fn show_lint(cx: &LateContext<'_, '_>, item: &ImplItem<'_>) {
let display_trait_id =
get_trait_def_id(cx, &["core", "fmt", "Display"]).expect("Failed to get trait ID of `Display`!");

View File

@ -32,7 +32,7 @@ declare_clippy_lint! {
declare_lint_pass!(InlineFnWithoutBody => [INLINE_FN_WITHOUT_BODY]);
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for InlineFnWithoutBody {
fn check_trait_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx TraitItem) {
fn check_trait_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx TraitItem<'_>) {
if let TraitItemKind::Method(_, TraitMethod::Required(_)) = item.kind {
check_attrs(cx, item.ident.name, &item.attrs);
}

View File

@ -47,7 +47,7 @@ impl LargeEnumVariant {
impl_lint_pass!(LargeEnumVariant => [LARGE_ENUM_VARIANT]);
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for LargeEnumVariant {
fn check_item(&mut self, cx: &LateContext<'_, '_>, item: &Item) {
fn check_item(&mut self, cx: &LateContext<'_, '_>, item: &Item<'_>) {
let did = cx.tcx.hir().local_def_id(item.hir_id);
if let ItemKind::Enum(ref def, _) = item.kind {
let ty = cx.tcx.type_of(did);

View File

@ -73,7 +73,7 @@ declare_clippy_lint! {
declare_lint_pass!(LenZero => [LEN_ZERO, LEN_WITHOUT_IS_EMPTY]);
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for LenZero {
fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx Item) {
fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx Item<'_>) {
if item.span.from_expansion() {
return;
}
@ -116,7 +116,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for LenZero {
}
}
fn check_trait_items(cx: &LateContext<'_, '_>, visited_trait: &Item, trait_items: &[TraitItemRef]) {
fn check_trait_items(cx: &LateContext<'_, '_>, visited_trait: &Item<'_>, trait_items: &[TraitItemRef]) {
fn is_named_self(cx: &LateContext<'_, '_>, item: &TraitItemRef, name: &str) -> bool {
item.ident.name.as_str() == name
&& if let AssocItemKind::Method { has_self } = item.kind {
@ -167,7 +167,7 @@ fn check_trait_items(cx: &LateContext<'_, '_>, visited_trait: &Item, trait_items
}
}
fn check_impl_items(cx: &LateContext<'_, '_>, item: &Item, impl_items: &[ImplItemRef]) {
fn check_impl_items(cx: &LateContext<'_, '_>, item: &Item<'_>, impl_items: &[ImplItemRef]) {
fn is_named_self(cx: &LateContext<'_, '_>, item: &ImplItemRef, name: &str) -> bool {
item.ident.name.as_str() == name
&& if let AssocItemKind::Method { has_self } = item.kind {

View File

@ -71,13 +71,13 @@ declare_clippy_lint! {
declare_lint_pass!(Lifetimes => [NEEDLESS_LIFETIMES, EXTRA_UNUSED_LIFETIMES]);
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Lifetimes {
fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx Item) {
fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx Item<'_>) {
if let ItemKind::Fn(ref sig, ref generics, id) = item.kind {
check_fn_inner(cx, &sig.decl, Some(id), generics, item.span, true);
}
}
fn check_impl_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx ImplItem) {
fn check_impl_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx ImplItem<'_>) {
if let ImplItemKind::Method(ref sig, id) = item.kind {
let report_extra_lifetimes = trait_ref_of_method(cx, item.hir_id).is_none();
check_fn_inner(
@ -91,7 +91,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Lifetimes {
}
}
fn check_trait_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx TraitItem) {
fn check_trait_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx TraitItem<'_>) {
if let TraitItemKind::Method(ref sig, ref body) = item.kind {
let body = match *body {
TraitMethod::Required(_) => None,

View File

@ -35,7 +35,7 @@ pub struct MainRecursion {
impl_lint_pass!(MainRecursion => [MAIN_RECURSION]);
impl LateLintPass<'_, '_> for MainRecursion {
fn check_crate(&mut self, _: &LateContext<'_, '_>, krate: &Crate) {
fn check_crate(&mut self, _: &LateContext<'_, '_>, krate: &Crate<'_>) {
self.has_no_std_attr = krate.attrs.iter().any(|attr| {
if let AttrKind::Normal(ref attr) = attr.kind {
attr.path == sym::no_std

View File

@ -1256,7 +1256,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Methods {
}
}
fn check_impl_item(&mut self, cx: &LateContext<'a, 'tcx>, impl_item: &'tcx hir::ImplItem) {
fn check_impl_item(&mut self, cx: &LateContext<'a, 'tcx>, impl_item: &'tcx hir::ImplItem<'_>) {
if in_external_macro(cx.sess(), impl_item.span) {
return;
}

View File

@ -238,7 +238,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MiscLints {
cx: &LateContext<'a, 'tcx>,
k: FnKind<'tcx>,
decl: &'tcx FnDecl,
body: &'tcx Body,
body: &'tcx Body<'_>,
_: Span,
_: HirId,
) {

View File

@ -77,7 +77,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingConstForFn {
cx: &LateContext<'_, '_>,
kind: FnKind<'_>,
_: &FnDecl,
_: &Body,
_: &Body<'_>,
span: Span,
hir_id: HirId,
) {

View File

@ -125,11 +125,11 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingDoc {
self.doc_hidden_stack.pop().expect("empty doc_hidden_stack");
}
fn check_crate(&mut self, cx: &LateContext<'a, 'tcx>, krate: &'tcx hir::Crate) {
fn check_crate(&mut self, cx: &LateContext<'a, 'tcx>, krate: &'tcx hir::Crate<'_>) {
self.check_missing_docs_attrs(cx, &krate.attrs, krate.span, "crate");
}
fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, it: &'tcx hir::Item) {
fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, it: &'tcx hir::Item<'_>) {
let desc = match it.kind {
hir::ItemKind::Const(..) => "a constant",
hir::ItemKind::Enum(..) => "an enum",
@ -162,7 +162,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingDoc {
self.check_missing_docs_attrs(cx, &it.attrs, it.span, desc);
}
fn check_trait_item(&mut self, cx: &LateContext<'a, 'tcx>, trait_item: &'tcx hir::TraitItem) {
fn check_trait_item(&mut self, cx: &LateContext<'a, 'tcx>, trait_item: &'tcx hir::TraitItem<'_>) {
let desc = match trait_item.kind {
hir::TraitItemKind::Const(..) => "an associated constant",
hir::TraitItemKind::Method(..) => "a trait method",
@ -172,7 +172,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingDoc {
self.check_missing_docs_attrs(cx, &trait_item.attrs, trait_item.span, desc);
}
fn check_impl_item(&mut self, cx: &LateContext<'a, 'tcx>, impl_item: &'tcx hir::ImplItem) {
fn check_impl_item(&mut self, cx: &LateContext<'a, 'tcx>, impl_item: &'tcx hir::ImplItem<'_>) {
// If the method is an impl for a trait, don't doc.
let def_id = cx.tcx.hir().local_def_id(impl_item.hir_id);
match cx.tcx.associated_item(def_id).container {
@ -193,13 +193,13 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingDoc {
self.check_missing_docs_attrs(cx, &impl_item.attrs, impl_item.span, desc);
}
fn check_struct_field(&mut self, cx: &LateContext<'a, 'tcx>, sf: &'tcx hir::StructField) {
fn check_struct_field(&mut self, cx: &LateContext<'a, 'tcx>, sf: &'tcx hir::StructField<'_>) {
if !sf.is_positional() {
self.check_missing_docs_attrs(cx, &sf.attrs, sf.span, "a struct field");
}
}
fn check_variant(&mut self, cx: &LateContext<'a, 'tcx>, v: &'tcx hir::Variant) {
fn check_variant(&mut self, cx: &LateContext<'a, 'tcx>, v: &'tcx hir::Variant<'_>) {
self.check_missing_docs_attrs(cx, &v.attrs, v.span, "a variant");
}
}

View File

@ -81,7 +81,7 @@ fn is_executable(cx: &LateContext<'_, '_>) -> bool {
declare_lint_pass!(MissingInline => [MISSING_INLINE_IN_PUBLIC_ITEMS]);
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingInline {
fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, it: &'tcx hir::Item) {
fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, it: &'tcx hir::Item<'_>) {
if lint::in_external_macro(cx.sess(), it.span) || is_executable(cx) {
return;
}
@ -94,7 +94,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingInline {
let desc = "a function";
check_missing_inline_attrs(cx, &it.attrs, it.span, desc);
},
hir::ItemKind::Trait(ref _is_auto, ref _unsafe, ref _generics, ref _bounds, ref trait_items) => {
hir::ItemKind::Trait(ref _is_auto, ref _unsafe, ref _generics, ref _bounds, trait_items) => {
// note: we need to check if the trait is exported so we can't use
// `LateLintPass::check_trait_item` here.
for tit in trait_items {
@ -130,7 +130,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingInline {
};
}
fn check_impl_item(&mut self, cx: &LateContext<'a, 'tcx>, impl_item: &'tcx hir::ImplItem) {
fn check_impl_item(&mut self, cx: &LateContext<'a, 'tcx>, impl_item: &'tcx hir::ImplItem<'_>) {
use rustc::ty::{ImplContainer, TraitContainer};
if lint::in_external_macro(cx.sess(), impl_item.span) || is_executable(cx) {
return;

View File

@ -108,14 +108,14 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NeedlessBorrow {
}
}
fn check_item(&mut self, _: &LateContext<'a, 'tcx>, item: &'tcx Item) {
fn check_item(&mut self, _: &LateContext<'a, 'tcx>, item: &'tcx Item<'_>) {
if item.attrs.iter().any(|a| a.check_name(sym!(automatically_derived))) {
debug_assert!(self.derived_item.is_none());
self.derived_item = Some(item.hir_id);
}
}
fn check_item_post(&mut self, _: &LateContext<'a, 'tcx>, item: &'tcx Item) {
fn check_item_post(&mut self, _: &LateContext<'a, 'tcx>, item: &'tcx Item<'_>) {
if let Some(id) = self.derived_item {
if item.hir_id == id {
self.derived_item = None;

View File

@ -72,7 +72,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NeedlessPassByValue {
cx: &LateContext<'a, 'tcx>,
kind: FnKind<'tcx>,
decl: &'tcx FnDecl,
body: &'tcx Body,
body: &'tcx Body<'_>,
span: Span,
hir_id: HirId,
) {
@ -144,7 +144,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NeedlessPassByValue {
let fn_sig = cx.tcx.fn_sig(fn_def_id);
let fn_sig = cx.tcx.erase_late_bound_regions(&fn_sig);
for (idx, ((input, &ty), arg)) in decl.inputs.iter().zip(fn_sig.inputs()).zip(&body.params).enumerate() {
for (idx, ((input, &ty), arg)) in decl.inputs.iter().zip(fn_sig.inputs()).zip(body.params).enumerate() {
// All spans generated from a proc-macro invocation are the same...
if span == input.span {
return;

View File

@ -93,8 +93,8 @@ pub struct NewWithoutDefault {
impl_lint_pass!(NewWithoutDefault => [NEW_WITHOUT_DEFAULT]);
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NewWithoutDefault {
fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx hir::Item) {
if let hir::ItemKind::Impl(_, _, _, _, None, _, ref items) = item.kind {
fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx hir::Item<'_>) {
if let hir::ItemKind::Impl(_, _, _, _, None, _, items) = item.kind {
for assoc_item in items {
if let hir::AssocItemKind::Method { has_self: false } = assoc_item.kind {
let impl_item = cx.tcx.hir().impl_item(assoc_item.id);

View File

@ -143,14 +143,14 @@ fn verify_ty_bound<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, ty: Ty<'tcx>, source: S
declare_lint_pass!(NonCopyConst => [DECLARE_INTERIOR_MUTABLE_CONST, BORROW_INTERIOR_MUTABLE_CONST]);
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NonCopyConst {
fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, it: &'tcx Item) {
fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, it: &'tcx Item<'_>) {
if let ItemKind::Const(hir_ty, ..) = &it.kind {
let ty = hir_ty_to_ty(cx.tcx, hir_ty);
verify_ty_bound(cx, ty, Source::Item { item: it.span });
}
}
fn check_trait_item(&mut self, cx: &LateContext<'a, 'tcx>, trait_item: &'tcx TraitItem) {
fn check_trait_item(&mut self, cx: &LateContext<'a, 'tcx>, trait_item: &'tcx TraitItem<'_>) {
if let TraitItemKind::Const(hir_ty, ..) = &trait_item.kind {
let ty = hir_ty_to_ty(cx.tcx, hir_ty);
verify_ty_bound(
@ -164,7 +164,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NonCopyConst {
}
}
fn check_impl_item(&mut self, cx: &LateContext<'a, 'tcx>, impl_item: &'tcx ImplItem) {
fn check_impl_item(&mut self, cx: &LateContext<'a, 'tcx>, impl_item: &'tcx ImplItem<'_>) {
if let ImplItemKind::Const(hir_ty, ..) = &impl_item.kind {
let item_hir_id = cx.tcx.hir().get_parent_node(impl_item.hir_id);
let item = cx.tcx.hir().expect_item(item_hir_id);

View File

@ -32,9 +32,9 @@ declare_clippy_lint! {
declare_lint_pass!(PartialEqNeImpl => [PARTIALEQ_NE_IMPL]);
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for PartialEqNeImpl {
fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx Item) {
fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx Item<'_>) {
if_chain! {
if let ItemKind::Impl(_, _, _, _, Some(ref trait_ref), _, ref impl_items) = item.kind;
if let ItemKind::Impl(_, _, _, _, Some(ref trait_ref), _, impl_items) = item.kind;
if !is_automatically_derived(&*item.attrs);
if let Some(eq_trait) = cx.tcx.lang_items().eq_trait();
if trait_ref.path.res.def_id() == eq_trait;

View File

@ -101,13 +101,13 @@ declare_clippy_lint! {
declare_lint_pass!(Ptr => [PTR_ARG, CMP_NULL, MUT_FROM_REF]);
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Ptr {
fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx Item) {
fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx Item<'_>) {
if let ItemKind::Fn(ref sig, _, body_id) = item.kind {
check_fn(cx, &sig.decl, item.hir_id, Some(body_id));
}
}
fn check_impl_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx ImplItem) {
fn check_impl_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx ImplItem<'_>) {
if let ImplItemKind::Method(ref sig, body_id) = item.kind {
let parent_item = cx.tcx.hir().get_parent_item(item.hir_id);
if let Some(Node::Item(it)) = cx.tcx.hir().find(parent_item) {
@ -119,7 +119,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Ptr {
}
}
fn check_trait_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx TraitItem) {
fn check_trait_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx TraitItem<'_>) {
if let TraitItemKind::Method(ref sig, ref trait_method) = item.kind {
let body_id = if let TraitMethod::Provided(b) = *trait_method {
Some(b)

View File

@ -76,7 +76,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for RedundantClone {
cx: &LateContext<'a, 'tcx>,
_: FnKind<'tcx>,
_: &'tcx FnDecl,
body: &'tcx Body,
body: &'tcx Body<'_>,
_: Span,
_: HirId,
) {

View File

@ -76,7 +76,7 @@ pub struct Regex {
impl_lint_pass!(Regex => [INVALID_REGEX, REGEX_MACRO, TRIVIAL_REGEX]);
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Regex {
fn check_crate(&mut self, _: &LateContext<'a, 'tcx>, _: &'tcx Crate) {
fn check_crate(&mut self, _: &LateContext<'a, 'tcx>, _: &'tcx Crate<'_>) {
self.spans.clear();
}

View File

@ -22,8 +22,8 @@ declare_clippy_lint! {
declare_lint_pass!(SerdeAPI => [SERDE_API_MISUSE]);
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for SerdeAPI {
fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx Item) {
if let ItemKind::Impl(_, _, _, _, Some(ref trait_ref), _, ref items) = item.kind {
fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx Item<'_>) {
if let ItemKind::Impl(_, _, _, _, Some(ref trait_ref), _, items) = item.kind {
let did = trait_ref.path.res.def_id();
if let Some(visit_did) = get_trait_def_id(cx, &paths::SERDE_DE_VISITOR) {
if did == visit_did {

View File

@ -89,7 +89,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Shadow {
cx: &LateContext<'a, 'tcx>,
_: FnKind<'tcx>,
decl: &'tcx FnDecl,
body: &'tcx Body,
body: &'tcx Body<'_>,
_: Span,
_: HirId,
) {
@ -100,7 +100,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Shadow {
}
}
fn check_fn<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, decl: &'tcx FnDecl, body: &'tcx Body) {
fn check_fn<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, decl: &'tcx FnDecl, body: &'tcx Body<'_>) {
let mut bindings = Vec::new();
for arg in iter_input_pats(decl, body) {
if let PatKind::Binding(.., ident, _) = arg.pat.kind {

View File

@ -128,7 +128,7 @@ impl<'a, 'tcx> TriviallyCopyPassByRef {
impl_lint_pass!(TriviallyCopyPassByRef => [TRIVIALLY_COPY_PASS_BY_REF]);
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for TriviallyCopyPassByRef {
fn check_trait_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx hir::TraitItem) {
fn check_trait_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx hir::TraitItem<'_>) {
if item.span.from_expansion() {
return;
}
@ -143,7 +143,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for TriviallyCopyPassByRef {
cx: &LateContext<'a, 'tcx>,
kind: FnKind<'tcx>,
decl: &'tcx FnDecl,
_body: &'tcx Body,
_body: &'tcx Body<'_>,
span: Span,
hir_id: HirId,
) {

View File

@ -170,7 +170,7 @@ declare_clippy_lint! {
declare_lint_pass!(Types => [BOX_VEC, VEC_BOX, OPTION_OPTION, LINKEDLIST, BORROWED_BOX]);
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Types {
fn check_fn(&mut self, cx: &LateContext<'_, '_>, _: FnKind<'_>, decl: &FnDecl, _: &Body, _: Span, id: HirId) {
fn check_fn(&mut self, cx: &LateContext<'_, '_>, _: FnKind<'_>, decl: &FnDecl, _: &Body<'_>, _: Span, id: HirId) {
// Skip trait implementations; see issue #605.
if let Some(hir::Node::Item(item)) = cx.tcx.hir().find(cx.tcx.hir().get_parent_item(id)) {
if let ItemKind::Impl(_, _, _, _, Some(..), _, _) = item.kind {
@ -181,11 +181,11 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Types {
check_fn_decl(cx, decl);
}
fn check_struct_field(&mut self, cx: &LateContext<'_, '_>, field: &hir::StructField) {
fn check_struct_field(&mut self, cx: &LateContext<'_, '_>, field: &hir::StructField<'_>) {
check_ty(cx, &field.ty, false);
}
fn check_trait_item(&mut self, cx: &LateContext<'_, '_>, item: &TraitItem) {
fn check_trait_item(&mut self, cx: &LateContext<'_, '_>, item: &TraitItem<'_>) {
match item.kind {
TraitItemKind::Const(ref ty, _) | TraitItemKind::Type(_, Some(ref ty)) => check_ty(cx, ty, false),
TraitItemKind::Method(ref sig, _) => check_fn_decl(cx, &sig.decl),
@ -1395,19 +1395,19 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for TypeComplexity {
cx: &LateContext<'a, 'tcx>,
_: FnKind<'tcx>,
decl: &'tcx FnDecl,
_: &'tcx Body,
_: &'tcx Body<'_>,
_: Span,
_: HirId,
) {
self.check_fndecl(cx, decl);
}
fn check_struct_field(&mut self, cx: &LateContext<'a, 'tcx>, field: &'tcx hir::StructField) {
fn check_struct_field(&mut self, cx: &LateContext<'a, 'tcx>, field: &'tcx hir::StructField<'_>) {
// enum variants are also struct fields now
self.check_type(cx, &field.ty);
}
fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx Item) {
fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx Item<'_>) {
match item.kind {
ItemKind::Static(ref ty, _, _) | ItemKind::Const(ref ty, _) => self.check_type(cx, ty),
// functions, enums, structs, impls and traits are covered
@ -1415,7 +1415,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for TypeComplexity {
}
}
fn check_trait_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx TraitItem) {
fn check_trait_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx TraitItem<'_>) {
match item.kind {
TraitItemKind::Const(ref ty, _) | TraitItemKind::Type(_, Some(ref ty)) => self.check_type(cx, ty),
TraitItemKind::Method(FnSig { ref decl, .. }, TraitMethod::Required(_)) => self.check_fndecl(cx, decl),
@ -1424,7 +1424,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for TypeComplexity {
}
}
fn check_impl_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx ImplItem) {
fn check_impl_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx ImplItem<'_>) {
match item.kind {
ImplItemKind::Const(ref ty, _) | ImplItemKind::TyAlias(ref ty) => self.check_type(cx, ty),
// methods are covered by check_fn
@ -2036,7 +2036,7 @@ declare_lint_pass!(ImplicitHasher => [IMPLICIT_HASHER]);
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for ImplicitHasher {
#[allow(clippy::cast_possible_truncation, clippy::too_many_lines)]
fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx Item) {
fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx Item<'_>) {
use syntax_pos::BytePos;
fn suggestion<'a, 'tcx>(
@ -2291,7 +2291,7 @@ impl<'a, 'b, 'tcx> ImplicitHasherConstructorVisitor<'a, 'b, 'tcx> {
}
impl<'a, 'b, 'tcx> Visitor<'tcx> for ImplicitHasherConstructorVisitor<'a, 'b, 'tcx> {
fn visit_body(&mut self, body: &'tcx Body) {
fn visit_body(&mut self, body: &'tcx Body<'_>) {
let prev_body = self.body;
self.body = self.cx.tcx.body_tables(body.id());
walk_body(self, body);

View File

@ -40,11 +40,11 @@ declare_clippy_lint! {
declare_lint_pass!(UnusedSelf => [UNUSED_SELF]);
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnusedSelf {
fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &Item) {
fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &Item<'_>) {
if item.span.from_expansion() {
return;
}
if let ItemKind::Impl(_, _, _, _, None, _, ref impl_item_refs) = item.kind {
if let ItemKind::Impl(_, _, _, _, None, _, impl_item_refs) = item.kind {
for impl_item_ref in impl_item_refs {
if_chain! {
if let ImplItemRef {

View File

@ -192,7 +192,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Unwrap {
cx: &LateContext<'a, 'tcx>,
kind: FnKind<'tcx>,
decl: &'tcx FnDecl,
body: &'tcx Body,
body: &'tcx Body<'_>,
span: Span,
fn_id: HirId,
) {

View File

@ -115,7 +115,7 @@ impl<'a, 'tcx> Visitor<'tcx> for TraitImplTyVisitor<'a, 'tcx> {
fn check_trait_method_impl_decl<'a, 'tcx>(
cx: &'a LateContext<'a, 'tcx>,
item_type: Ty<'tcx>,
impl_item: &ImplItem,
impl_item: &ImplItem<'_>,
impl_decl: &'tcx FnDecl,
impl_trait_ref: &ty::TraitRef<'_>,
) {
@ -165,12 +165,12 @@ fn check_trait_method_impl_decl<'a, 'tcx>(
}
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UseSelf {
fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx Item) {
fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx Item<'_>) {
if in_external_macro(cx.sess(), item.span) {
return;
}
if_chain! {
if let ItemKind::Impl(.., ref item_type, ref refs) = item.kind;
if let ItemKind::Impl(.., ref item_type, refs) = item.kind;
if let TyKind::Path(QPath::Resolved(_, ref item_path)) = item_type.kind;
then {
let parameters = &item_path.segments.last().expect(SEGMENTS_MSG).args;
@ -257,7 +257,7 @@ impl<'a, 'tcx> Visitor<'tcx> for UseSelfVisitor<'a, 'tcx> {
walk_path(self, path);
}
fn visit_item(&mut self, item: &'tcx Item) {
fn visit_item(&mut self, item: &'tcx Item<'_>) {
match item.kind {
ItemKind::Use(..)
| ItemKind::Static(..)

View File

@ -64,7 +64,7 @@ fn done() {
}
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Author {
fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx hir::Item) {
fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx hir::Item<'_>) {
if !has_attr(cx.sess(), &item.attrs) {
return;
}
@ -73,7 +73,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Author {
done();
}
fn check_impl_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx hir::ImplItem) {
fn check_impl_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx hir::ImplItem<'_>) {
if !has_attr(cx.sess(), &item.attrs) {
return;
}
@ -82,7 +82,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Author {
done();
}
fn check_trait_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx hir::TraitItem) {
fn check_trait_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx hir::TraitItem<'_>) {
if !has_attr(cx.sess(), &item.attrs) {
return;
}
@ -91,7 +91,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Author {
done();
}
fn check_variant(&mut self, cx: &LateContext<'a, 'tcx>, var: &'tcx hir::Variant) {
fn check_variant(&mut self, cx: &LateContext<'a, 'tcx>, var: &'tcx hir::Variant<'_>) {
if !has_attr(cx.sess(), &var.attrs) {
return;
}
@ -100,7 +100,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Author {
done();
}
fn check_struct_field(&mut self, cx: &LateContext<'a, 'tcx>, field: &'tcx hir::StructField) {
fn check_struct_field(&mut self, cx: &LateContext<'a, 'tcx>, field: &'tcx hir::StructField<'_>) {
if !has_attr(cx.sess(), &field.attrs) {
return;
}
@ -136,7 +136,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Author {
done();
}
fn check_foreign_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx hir::ForeignItem) {
fn check_foreign_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx hir::ForeignItem<'_>) {
if !has_attr(cx.sess(), &item.attrs) {
return;
}

View File

@ -34,14 +34,14 @@ declare_clippy_lint! {
declare_lint_pass!(DeepCodeInspector => [DEEP_CODE_INSPECTION]);
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for DeepCodeInspector {
fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx hir::Item) {
fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx hir::Item<'_>) {
if !has_attr(cx.sess(), &item.attrs) {
return;
}
print_item(cx, item);
}
fn check_impl_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx hir::ImplItem) {
fn check_impl_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx hir::ImplItem<'_>) {
if !has_attr(cx.sess(), &item.attrs) {
return;
}
@ -326,7 +326,7 @@ fn print_expr(cx: &LateContext<'_, '_>, expr: &hir::Expr, indent: usize) {
}
}
fn print_item(cx: &LateContext<'_, '_>, item: &hir::Item) {
fn print_item(cx: &LateContext<'_, '_>, item: &hir::Item<'_>) {
let did = cx.tcx.hir().local_def_id(item.hir_id);
println!("item `{}`", item.ident.name);
match item.vis.node {

View File

@ -165,7 +165,7 @@ pub struct LintWithoutLintPass {
impl_lint_pass!(LintWithoutLintPass => [LINT_WITHOUT_LINT_PASS]);
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for LintWithoutLintPass {
fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx Item) {
fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx Item<'_>) {
if let hir::ItemKind::Static(ref ty, Mutability::Not, _) = item.kind {
if is_lint_ref_type(cx, ty) {
self.declared_lints.insert(item.ident.name, item.span);
@ -191,7 +191,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for LintWithoutLintPass {
}
}
fn check_crate_post(&mut self, cx: &LateContext<'a, 'tcx>, _: &'tcx Crate) {
fn check_crate_post(&mut self, cx: &LateContext<'a, 'tcx>, _: &'tcx Crate<'_>) {
for (lint_name, &lint_span) in &self.declared_lints {
// When using the `declare_tool_lint!` macro, the original `lint_span`'s
// file points to "<rustc macros>".

View File

@ -901,7 +901,7 @@ pub fn is_self_ty(slf: &hir::Ty) -> bool {
false
}
pub fn iter_input_pats<'tcx>(decl: &FnDecl, body: &'tcx Body) -> impl Iterator<Item = &'tcx Param> {
pub fn iter_input_pats<'tcx>(decl: &FnDecl, body: &'tcx Body<'_>) -> impl Iterator<Item = &'tcx Param> {
(0..decl.inputs.len()).map(move |i| &body.params[i])
}

View File

@ -26,7 +26,7 @@ fn extract_clone_suggestions<'a, 'tcx>(
cx: &LateContext<'a, 'tcx>,
name: Name,
replace: &[(&'static str, &'static str)],
body: &'tcx Body,
body: &'tcx Body<'_>,
) -> Option<Vec<(Span, Cow<'static, str>)>> {
let mut visitor = PtrCloneVisitor {
cx,