about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJarredAllen <jarredallen73@gmail.com>2020-07-03 20:28:40 -0700
committerJarredAllen <jarredallen73@gmail.com>2020-07-03 21:22:23 -0700
commitc8f700ea697f74ef8f86891b050c859cf457e3ab (patch)
tree49cbbe0c038ae067a7c256f94c876b4dc04985a6
parent1c32263176d95ae47928d1955e44a4315ffcea2d (diff)
downloadrust-c8f700ea697f74ef8f86891b050c859cf457e3ab.tar.gz
rust-c8f700ea697f74ef8f86891b050c859cf457e3ab.zip
Fixed compile errors
-rw-r--r--clippy_lints/src/attrs.rs2
-rw-r--r--clippy_lints/src/if_let_mutex.rs2
-rw-r--r--clippy_lints/src/minmax.rs14
-rw-r--r--clippy_lints/src/option_if_let_else.rs14
-rw-r--r--clippy_lints/src/shadow.rs2
5 files changed, 14 insertions, 20 deletions
diff --git a/clippy_lints/src/attrs.rs b/clippy_lints/src/attrs.rs
index c4397560d7d..d68d0d8ccf5 100644
--- a/clippy_lints/src/attrs.rs
+++ b/clippy_lints/src/attrs.rs
@@ -480,7 +480,7 @@ fn is_relevant_trait(cx: &LateContext<'_>, item: &TraitItem<'_>) -> bool {
     }
 }
 
-fn is_relevant_block(cx: &LateContext<'_, '_>, tables: &ty::TypeckTables<'_>, block: &Block<'_>) -> bool {
+fn is_relevant_block(cx: &LateContext<'_>, tables: &ty::TypeckTables<'_>, block: &Block<'_>) -> bool {
     block.stmts.first().map_or(
         block.expr.as_ref().map_or(false, |e| is_relevant_expr(cx, tables, e)),
         |stmt| match &stmt.kind {
diff --git a/clippy_lints/src/if_let_mutex.rs b/clippy_lints/src/if_let_mutex.rs
index 5426e14ead5..fbd2eeacc6e 100644
--- a/clippy_lints/src/if_let_mutex.rs
+++ b/clippy_lints/src/if_let_mutex.rs
@@ -136,7 +136,7 @@ impl<'tcx> Visitor<'tcx> for ArmVisitor<'_, 'tcx> {
 }
 
 impl<'tcx, 'l> ArmVisitor<'tcx, 'l> {
-    fn same_mutex(&self, cx: &LateContext<'_, '_>, op_mutex: &Expr<'_>) -> bool {
+    fn same_mutex(&self, cx: &LateContext<'_>, op_mutex: &Expr<'_>) -> bool {
         self.found_mutex
             .map_or(false, |arm_mutex| SpanlessEq::new(cx).eq_expr(op_mutex, arm_mutex))
     }
diff --git a/clippy_lints/src/minmax.rs b/clippy_lints/src/minmax.rs
index 2e5f5f10f4b..c8aa98d3489 100644
--- a/clippy_lints/src/minmax.rs
+++ b/clippy_lints/src/minmax.rs
@@ -86,18 +86,12 @@ fn fetch_const<'a>(cx: &LateContext<'_>, args: &'a [Expr<'a>], m: MinMax) -> Opt
     if args.len() != 2 {
         return None;
     }
-    constant_simple(cx, cx.tables, &args[0]).map_or_else(
-        || {
-            if let Some(c) = constant_simple(cx, cx.tables(), &args[1]) {
-                Some((m, c, &args[0]))
-            } else {
-                None
-            }
-        },
+    constant_simple(cx, cx.tables(), &args[0]).map_or_else(
+        || constant_simple(cx, cx.tables(), &args[1]).map(|c| (m, c, &args[0])),
         |c| {
-            if constant_simple(cx, cx.tables, &args[1]).is_none() {
+            if constant_simple(cx, cx.tables(), &args[1]).is_none() {
                 // otherwise ignore
-                Some((c, &args[1]))
+                Some((m, c, &args[1]))
             } else {
                 None
             }
diff --git a/clippy_lints/src/option_if_let_else.rs b/clippy_lints/src/option_if_let_else.rs
index ab9ea76a838..8dbe58763bf 100644
--- a/clippy_lints/src/option_if_let_else.rs
+++ b/clippy_lints/src/option_if_let_else.rs
@@ -70,9 +70,9 @@ declare_clippy_lint! {
 declare_lint_pass!(OptionIfLetElse => [OPTION_IF_LET_ELSE]);
 
 /// Returns true iff the given expression is the result of calling `Result::ok`
-fn is_result_ok(cx: &LateContext<'_, '_>, expr: &'_ Expr<'_>) -> bool {
+fn is_result_ok(cx: &LateContext<'_>, expr: &'_ Expr<'_>) -> bool {
     if let ExprKind::MethodCall(ref path, _, &[ref receiver], _) = &expr.kind {
-        path.ident.name.to_ident_string() == "ok" && match_type(cx, &cx.tables.expr_ty(&receiver), &paths::RESULT)
+        path.ident.name.to_ident_string() == "ok" && match_type(cx, &cx.tables().expr_ty(&receiver), &paths::RESULT)
     } else {
         false
     }
@@ -157,7 +157,7 @@ fn extract_body_from_arm<'a>(arm: &'a Arm<'a>) -> Option<&'a Expr<'a>> {
 
 /// If this is the else body of an if/else expression, then we need to wrap
 /// it in curcly braces. Otherwise, we don't.
-fn should_wrap_in_braces(cx: &LateContext<'_, '_>, expr: &Expr<'_>) -> bool {
+fn should_wrap_in_braces(cx: &LateContext<'_>, expr: &Expr<'_>) -> bool {
     utils::get_enclosing_block(cx, expr.hir_id).map_or(false, |parent| {
         if let Some(Expr {
             kind:
@@ -181,7 +181,7 @@ fn should_wrap_in_braces(cx: &LateContext<'_, '_>, expr: &Expr<'_>) -> bool {
     })
 }
 
-fn format_option_in_sugg(cx: &LateContext<'_, '_>, cond_expr: &Expr<'_>, as_ref: bool, as_mut: bool) -> String {
+fn format_option_in_sugg(cx: &LateContext<'_>, cond_expr: &Expr<'_>, as_ref: bool, as_mut: bool) -> String {
     format!(
         "{}{}",
         Sugg::hir(cx, cond_expr, "..").maybe_par(),
@@ -198,7 +198,7 @@ fn format_option_in_sugg(cx: &LateContext<'_, '_>, cond_expr: &Expr<'_>, as_ref:
 /// If this expression is the option if let/else construct we're detecting, then
 /// this function returns an `OptionIfLetElseOccurence` struct with details if
 /// this construct is found, or None if this construct is not found.
-fn detect_option_if_let_else<'a>(cx: &LateContext<'_, 'a>, expr: &'a Expr<'a>) -> Option<OptionIfLetElseOccurence> {
+fn detect_option_if_let_else(cx: &LateContext<'_>, expr: &Expr<'_>) -> Option<OptionIfLetElseOccurence> {
     if_chain! {
         if !utils::in_macro(expr.span); // Don't lint macros, because it behaves weirdly
         if let ExprKind::Match(cond_expr, arms, MatchSource::IfLetDesugar{contains_else_clause: true}) = &expr.kind;
@@ -242,8 +242,8 @@ fn detect_option_if_let_else<'a>(cx: &LateContext<'_, 'a>, expr: &'a Expr<'a>) -
     }
 }
 
-impl<'a, 'tcx> LateLintPass<'a, 'tcx> for OptionIfLetElse {
-    fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr<'_>) {
+impl<'a> LateLintPass<'a> for OptionIfLetElse {
+    fn check_expr(&mut self, cx: &LateContext<'a>, expr: &Expr<'_>) {
         if let Some(detection) = detect_option_if_let_else(cx, expr) {
             span_lint_and_sugg(
                 cx,
diff --git a/clippy_lints/src/shadow.rs b/clippy_lints/src/shadow.rs
index f16db2df3a9..4cdff63f118 100644
--- a/clippy_lints/src/shadow.rs
+++ b/clippy_lints/src/shadow.rs
@@ -164,7 +164,7 @@ fn check_local<'tcx>(cx: &LateContext<'tcx>, local: &'tcx Local<'_>, bindings: &
 }
 
 fn is_binding(cx: &LateContext<'_>, pat_id: HirId) -> bool {
-    let var_ty = cx.tables.node_type_opt(pat_id);
+    let var_ty = cx.tables().node_type_opt(pat_id);
     var_ty.map_or(false, |var_ty| match var_ty.kind {
         ty::Adt(..) => false,
         _ => true,