Skip to content

Commit 020cc8c

Browse files
committed
Fixed compile errors
1 parent 1c32263 commit 020cc8c

File tree

5 files changed

+13
-13
lines changed

5 files changed

+13
-13
lines changed

clippy_lints/src/attrs.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,7 @@ fn is_relevant_trait(cx: &LateContext<'_>, item: &TraitItem<'_>) -> bool {
480480
}
481481
}
482482

483-
fn is_relevant_block(cx: &LateContext<'_, '_>, tables: &ty::TypeckTables<'_>, block: &Block<'_>) -> bool {
483+
fn is_relevant_block(cx: &LateContext<'_>, tables: &ty::TypeckTables<'_>, block: &Block<'_>) -> bool {
484484
block.stmts.first().map_or(
485485
block.expr.as_ref().map_or(false, |e| is_relevant_expr(cx, tables, e)),
486486
|stmt| match &stmt.kind {

clippy_lints/src/if_let_mutex.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ impl<'tcx> Visitor<'tcx> for ArmVisitor<'_, 'tcx> {
136136
}
137137

138138
impl<'tcx, 'l> ArmVisitor<'tcx, 'l> {
139-
fn same_mutex(&self, cx: &LateContext<'_, '_>, op_mutex: &Expr<'_>) -> bool {
139+
fn same_mutex(&self, cx: &LateContext<'_>, op_mutex: &Expr<'_>) -> bool {
140140
self.found_mutex
141141
.map_or(false, |arm_mutex| SpanlessEq::new(cx).eq_expr(op_mutex, arm_mutex))
142142
}

clippy_lints/src/minmax.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ fn fetch_const<'a>(cx: &LateContext<'_>, args: &'a [Expr<'a>], m: MinMax) -> Opt
8686
if args.len() != 2 {
8787
return None;
8888
}
89-
constant_simple(cx, cx.tables, &args[0]).map_or_else(
89+
constant_simple(cx, cx.tables(), &args[0]).map_or_else(
9090
|| {
9191
if let Some(c) = constant_simple(cx, cx.tables(), &args[1]) {
9292
Some((m, c, &args[0]))
@@ -95,9 +95,9 @@ fn fetch_const<'a>(cx: &LateContext<'_>, args: &'a [Expr<'a>], m: MinMax) -> Opt
9595
}
9696
},
9797
|c| {
98-
if constant_simple(cx, cx.tables, &args[1]).is_none() {
98+
if constant_simple(cx, cx.tables(), &args[1]).is_none() {
9999
// otherwise ignore
100-
Some((c, &args[1]))
100+
Some((m, c, &args[1]))
101101
} else {
102102
None
103103
}

clippy_lints/src/option_if_let_else.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,9 @@ declare_clippy_lint! {
7070
declare_lint_pass!(OptionIfLetElse => [OPTION_IF_LET_ELSE]);
7171

7272
/// Returns true iff the given expression is the result of calling `Result::ok`
73-
fn is_result_ok(cx: &LateContext<'_, '_>, expr: &'_ Expr<'_>) -> bool {
73+
fn is_result_ok(cx: &LateContext<'_>, expr: &'_ Expr<'_>) -> bool {
7474
if let ExprKind::MethodCall(ref path, _, &[ref receiver], _) = &expr.kind {
75-
path.ident.name.to_ident_string() == "ok" && match_type(cx, &cx.tables.expr_ty(&receiver), &paths::RESULT)
75+
path.ident.name.to_ident_string() == "ok" && match_type(cx, &cx.tables().expr_ty(&receiver), &paths::RESULT)
7676
} else {
7777
false
7878
}
@@ -157,7 +157,7 @@ fn extract_body_from_arm<'a>(arm: &'a Arm<'a>) -> Option<&'a Expr<'a>> {
157157

158158
/// If this is the else body of an if/else expression, then we need to wrap
159159
/// it in curcly braces. Otherwise, we don't.
160-
fn should_wrap_in_braces(cx: &LateContext<'_, '_>, expr: &Expr<'_>) -> bool {
160+
fn should_wrap_in_braces(cx: &LateContext<'_>, expr: &Expr<'_>) -> bool {
161161
utils::get_enclosing_block(cx, expr.hir_id).map_or(false, |parent| {
162162
if let Some(Expr {
163163
kind:
@@ -181,7 +181,7 @@ fn should_wrap_in_braces(cx: &LateContext<'_, '_>, expr: &Expr<'_>) -> bool {
181181
})
182182
}
183183

184-
fn format_option_in_sugg(cx: &LateContext<'_, '_>, cond_expr: &Expr<'_>, as_ref: bool, as_mut: bool) -> String {
184+
fn format_option_in_sugg(cx: &LateContext<'_>, cond_expr: &Expr<'_>, as_ref: bool, as_mut: bool) -> String {
185185
format!(
186186
"{}{}",
187187
Sugg::hir(cx, cond_expr, "..").maybe_par(),
@@ -198,7 +198,7 @@ fn format_option_in_sugg(cx: &LateContext<'_, '_>, cond_expr: &Expr<'_>, as_ref:
198198
/// If this expression is the option if let/else construct we're detecting, then
199199
/// this function returns an `OptionIfLetElseOccurence` struct with details if
200200
/// this construct is found, or None if this construct is not found.
201-
fn detect_option_if_let_else<'a>(cx: &LateContext<'_, 'a>, expr: &'a Expr<'a>) -> Option<OptionIfLetElseOccurence> {
201+
fn detect_option_if_let_else(cx: &LateContext<'_>, expr: &Expr<'_>) -> Option<OptionIfLetElseOccurence> {
202202
if_chain! {
203203
if !utils::in_macro(expr.span); // Don't lint macros, because it behaves weirdly
204204
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>) -
242242
}
243243
}
244244

245-
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for OptionIfLetElse {
246-
fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr<'_>) {
245+
impl<'a> LateLintPass<'a> for OptionIfLetElse {
246+
fn check_expr(&mut self, cx: &LateContext<'a>, expr: &Expr<'_>) {
247247
if let Some(detection) = detect_option_if_let_else(cx, expr) {
248248
span_lint_and_sugg(
249249
cx,

clippy_lints/src/shadow.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ fn check_local<'tcx>(cx: &LateContext<'tcx>, local: &'tcx Local<'_>, bindings: &
164164
}
165165

166166
fn is_binding(cx: &LateContext<'_>, pat_id: HirId) -> bool {
167-
let var_ty = cx.tables.node_type_opt(pat_id);
167+
let var_ty = cx.tables().node_type_opt(pat_id);
168168
var_ty.map_or(false, |var_ty| match var_ty.kind {
169169
ty::Adt(..) => false,
170170
_ => true,

0 commit comments

Comments
 (0)