X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=clippy_lints%2Fsrc%2Fbooleans.rs;h=cc399a1f8a00946dba1a0c31d820925a8541beb3;hb=81810fa8f400b1d941b8bf14b2d085cf0a045ae1;hp=f16d10fde9297aaeca9cd4e3bf8b3fc1d2021f0c;hpb=2538e6388590fe592cd41c7d38bb1ade63f7d309;p=rust.git diff --git a/clippy_lints/src/booleans.rs b/clippy_lints/src/booleans.rs index f16d10fde92..cc399a1f8a0 100644 --- a/clippy_lints/src/booleans.rs +++ b/clippy_lints/src/booleans.rs @@ -247,8 +247,8 @@ fn simplify_not(cx: &LateContext<'_, '_>, expr: &Expr<'_>) -> Option { )) }) }, - ExprKind::MethodCall(path, _, args) if args.len() == 1 => { - let type_of_receiver = cx.tables.expr_ty(&args[0]); + ExprKind::MethodCall(path, _, args, _) if args.len() == 1 => { + let type_of_receiver = cx.tables().expr_ty(&args[0]); if !is_type_diagnostic_item(cx, type_of_receiver, sym!(option_type)) && !is_type_diagnostic_item(cx, type_of_receiver, sym!(result_type)) { @@ -376,13 +376,13 @@ fn bool_expr(&self, e: &'tcx Expr<'_>) { LOGIC_BUG, e.span, "this boolean expression contains a logic bug", - |db| { - db.span_help( + |diag| { + diag.span_help( h2q.terminals[i].span, "this expression can be optimized out by applying boolean operations to the \ outer expression", ); - db.span_suggestion( + diag.span_suggestion( e.span, "it would look like the following", suggest(self.cx, suggestion, &h2q.terminals), @@ -411,8 +411,8 @@ fn bool_expr(&self, e: &'tcx Expr<'_>) { NONMINIMAL_BOOL, e.span, "this boolean expression can be simplified", - |db| { - db.span_suggestions( + |diag| { + diag.span_suggestions( e.span, "try", suggestions.into_iter(), @@ -450,7 +450,7 @@ fn visit_expr(&mut self, e: &'tcx Expr<'_>) { self.bool_expr(e) }, ExprKind::Unary(UnOp::UnNot, inner) => { - if self.cx.tables.node_types()[inner.hir_id].is_bool() { + if self.cx.tables().node_types()[inner.hir_id].is_bool() { self.bool_expr(e); } else { walk_expr(self, e); @@ -465,7 +465,7 @@ fn nested_visit_map(&mut self) -> NestedVisitorMap { } fn implements_ord<'a, 'tcx>(cx: &'a LateContext<'a, 'tcx>, expr: &Expr<'_>) -> bool { - let ty = cx.tables.expr_ty(expr); + let ty = cx.tables().expr_ty(expr); get_trait_def_id(cx, &paths::ORD).map_or(false, |id| implements_trait(cx, ty, id, &[])) }