From 9897927504ca64b90e2e7a742a22d7ddb6a3bc69 Mon Sep 17 00:00:00 2001 From: flip1995 Date: Thu, 6 Feb 2020 20:29:58 +0100 Subject: [PATCH] Rustup to rust-lang/rust#68788 --- clippy_lints/src/misc_early.rs | 4 ++-- clippy_lints/src/non_expressive_names.rs | 2 +- clippy_lints/src/returns.rs | 9 +++++---- clippy_lints/src/utils/internal_lints.rs | 8 +++----- tests/ui/custom_ice_message.stderr | 2 +- 5 files changed, 12 insertions(+), 13 deletions(-) diff --git a/clippy_lints/src/misc_early.rs b/clippy_lints/src/misc_early.rs index 6f54750cb9b9..e0e2a0caee4e 100644 --- a/clippy_lints/src/misc_early.rs +++ b/clippy_lints/src/misc_early.rs @@ -372,10 +372,10 @@ impl EarlyLintPass for MiscEarlyLints { check_unneeded_wildcard_pattern(cx, pat); } - fn check_fn(&mut self, cx: &EarlyContext<'_>, _: FnKind<'_>, decl: &FnDecl, _: Span, _: NodeId) { + fn check_fn(&mut self, cx: &EarlyContext<'_>, fn_kind: FnKind<'_>, _: Span, _: NodeId) { let mut registered_names: FxHashMap = FxHashMap::default(); - for arg in &decl.inputs { + for arg in &fn_kind.decl().inputs { if let PatKind::Ident(_, ident, None) = arg.pat.kind { let arg_name = ident.to_string(); diff --git a/clippy_lints/src/non_expressive_names.rs b/clippy_lints/src/non_expressive_names.rs index b9df82d65e3b..2a7fbe6c0c64 100644 --- a/clippy_lints/src/non_expressive_names.rs +++ b/clippy_lints/src/non_expressive_names.rs @@ -352,7 +352,7 @@ impl<'a, 'tcx> Visitor<'tcx> for SimilarNamesLocalVisitor<'a, 'tcx> { impl EarlyLintPass for NonExpressiveNames { fn check_item(&mut self, cx: &EarlyContext<'_>, item: &Item) { - if let ItemKind::Fn(ref sig, _, ref blk) = item.kind { + if let ItemKind::Fn(ref sig, _, Some(ref blk)) = item.kind { do_check(self, cx, &item.attrs, &sig.decl, blk); } } diff --git a/clippy_lints/src/returns.rs b/clippy_lints/src/returns.rs index c903df0f2119..6bf373a9a626 100644 --- a/clippy_lints/src/returns.rs +++ b/clippy_lints/src/returns.rs @@ -235,13 +235,14 @@ impl Return { } impl EarlyLintPass for Return { - fn check_fn(&mut self, cx: &EarlyContext<'_>, kind: FnKind<'_>, decl: &ast::FnDecl, span: Span, _: ast::NodeId) { + fn check_fn(&mut self, cx: &EarlyContext<'_>, kind: FnKind<'_>, span: Span, _: ast::NodeId) { match kind { - FnKind::ItemFn(.., block) | FnKind::Method(.., block) => self.check_block_return(cx, block), - FnKind::Closure(body) => self.check_final_expr(cx, body, Some(body.span), RetReplacement::Empty), + FnKind::Fn(.., Some(block)) => self.check_block_return(cx, block), + FnKind::Closure(_, body) => self.check_final_expr(cx, body, Some(body.span), RetReplacement::Empty), + FnKind::Fn(.., None) => {}, } if_chain! { - if let ast::FunctionRetTy::Ty(ref ty) = decl.output; + if let ast::FunctionRetTy::Ty(ref ty) = kind.decl().output; if let ast::TyKind::Tup(ref vals) = ty.kind; if vals.is_empty() && !ty.span.from_expansion() && get_def(span) == get_def(ty.span); then { diff --git a/clippy_lints/src/utils/internal_lints.rs b/clippy_lints/src/utils/internal_lints.rs index af07cf666583..945999de89fe 100644 --- a/clippy_lints/src/utils/internal_lints.rs +++ b/clippy_lints/src/utils/internal_lints.rs @@ -380,18 +380,16 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for OuterExpnDataPass { declare_lint_pass!(ProduceIce => [PRODUCE_ICE]); impl EarlyLintPass for ProduceIce { - fn check_fn(&mut self, _: &EarlyContext<'_>, fn_kind: FnKind<'_>, _: &ast::FnDecl, _: Span, _: ast::NodeId) { + fn check_fn(&mut self, _: &EarlyContext<'_>, fn_kind: FnKind<'_>, _: Span, _: ast::NodeId) { if is_trigger_fn(fn_kind) { - panic!("Testing the ICE message"); + panic!("Would you like some help with that?"); } } } fn is_trigger_fn(fn_kind: FnKind<'_>) -> bool { match fn_kind { - FnKind::ItemFn(ident, ..) | FnKind::Method(ident, ..) => { - ident.name.as_str() == "it_looks_like_you_are_trying_to_kill_clippy" - }, + FnKind::Fn(_, ident, ..) => ident.name.as_str() == "it_looks_like_you_are_trying_to_kill_clippy", FnKind::Closure(..) => false, } } diff --git a/tests/ui/custom_ice_message.stderr b/tests/ui/custom_ice_message.stderr index 36f243ebc5fb..a9a65a38c109 100644 --- a/tests/ui/custom_ice_message.stderr +++ b/tests/ui/custom_ice_message.stderr @@ -1,4 +1,4 @@ -thread 'rustc' panicked at 'Testing the ICE message', clippy_lints/src/utils/internal_lints.rs +thread 'rustc' panicked at 'Would you like some help with that?', clippy_lints/src/utils/internal_lints.rs note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace error: internal compiler error: unexpected panic