From 29d43f63bd41e794162a8118b422eff66b5f47eb Mon Sep 17 00:00:00 2001 From: Dylan MacKenzie Date: Sun, 4 Oct 2020 15:23:20 -0700 Subject: [PATCH 1/2] clippy: `(Body, DefId)` -> `Body` --- clippy_lints/src/missing_const_for_fn.rs | 2 +- clippy_lints/src/redundant_clone.rs | 2 +- clippy_lints/src/utils/qualify_min_const_fn.rs | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/clippy_lints/src/missing_const_for_fn.rs b/clippy_lints/src/missing_const_for_fn.rs index e5f7cc511112..80da04fb7de9 100644 --- a/clippy_lints/src/missing_const_for_fn.rs +++ b/clippy_lints/src/missing_const_for_fn.rs @@ -118,7 +118,7 @@ impl<'tcx> LateLintPass<'tcx> for MissingConstForFn { let mir = cx.tcx.optimized_mir(def_id); - if let Err((span, err)) = is_min_const_fn(cx.tcx, def_id.to_def_id(), &mir) { + if let Err((span, err)) = is_min_const_fn(cx.tcx, &mir) { if rustc_mir::const_eval::is_min_const_fn(cx.tcx, def_id.to_def_id()) { cx.tcx.sess.span_err(span, &err); } diff --git a/clippy_lints/src/redundant_clone.rs b/clippy_lints/src/redundant_clone.rs index 4d20a819804d..b4502c668dcb 100644 --- a/clippy_lints/src/redundant_clone.rs +++ b/clippy_lints/src/redundant_clone.rs @@ -86,7 +86,7 @@ impl<'tcx> LateLintPass<'tcx> for RedundantClone { let mir = cx.tcx.optimized_mir(def_id.to_def_id()); let maybe_storage_live_result = MaybeStorageLive - .into_engine(cx.tcx, mir, def_id.to_def_id()) + .into_engine(cx.tcx, mir) .pass_name("redundant_clone") .iterate_to_fixpoint() .into_results_cursor(mir); diff --git a/clippy_lints/src/utils/qualify_min_const_fn.rs b/clippy_lints/src/utils/qualify_min_const_fn.rs index 6809b1fa88d3..19d890b4554a 100644 --- a/clippy_lints/src/utils/qualify_min_const_fn.rs +++ b/clippy_lints/src/utils/qualify_min_const_fn.rs @@ -10,7 +10,8 @@ use std::borrow::Cow; type McfResult = Result<(), (Span, Cow<'static, str>)>; -pub fn is_min_const_fn(tcx: TyCtxt<'tcx>, def_id: DefId, body: &'a Body<'tcx>) -> McfResult { +pub fn is_min_const_fn(tcx: TyCtxt<'tcx>, body: &'a Body<'tcx>) -> McfResult { + let def_id = body.source.def_id(); let mut current = def_id; loop { let predicates = tcx.predicates_of(current); From 5554641fceb640116316201bf669c04e1f86fcc3 Mon Sep 17 00:00:00 2001 From: Eduardo Broto Date: Mon, 5 Oct 2020 22:32:04 +0200 Subject: [PATCH 2/2] Fix rustup fallout --- clippy_lints/src/attrs.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/clippy_lints/src/attrs.rs b/clippy_lints/src/attrs.rs index c8f153e7201c..f6eadbdef0bb 100644 --- a/clippy_lints/src/attrs.rs +++ b/clippy_lints/src/attrs.rs @@ -137,17 +137,17 @@ declare_clippy_lint! { /// **Example:** /// ```rust /// // Good (as inner attribute) - /// #![inline(always)] + /// #![allow(dead_code)] /// /// fn this_is_fine() { } /// /// // Bad - /// #[inline(always)] + /// #[allow(dead_code)] /// /// fn not_quite_good_code() { } /// /// // Good (as outer attribute) - /// #[inline(always)] + /// #[allow(dead_code)] /// fn this_is_fine_too() { } /// ``` pub EMPTY_LINE_AFTER_OUTER_ATTR,