Skip to content

Commit fa0f6a8

Browse files
committed
Auto merge of #5711 - flip1995:rustup, r=flip1995
Rustup changelog: none
2 parents 7427065 + 51592f8 commit fa0f6a8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+192
-222
lines changed

clippy_lints/src/atomic_ordering.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ fn match_ordering_def_path(cx: &LateContext<'_, '_>, did: DefId, orderings: &[&s
7070

7171
fn check_atomic_load_store(cx: &LateContext<'_, '_>, expr: &Expr<'_>) {
7272
if_chain! {
73-
if let ExprKind::MethodCall(ref method_path, _, args) = &expr.kind;
73+
if let ExprKind::MethodCall(ref method_path, _, args, _) = &expr.kind;
7474
let method = method_path.ident.name.as_str();
7575
if type_is_atomic(cx, &args[0]);
7676
if method == "load" || method == "store";

clippy_lints/src/booleans.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ fn simplify_not(cx: &LateContext<'_, '_>, expr: &Expr<'_>) -> Option<String> {
247247
))
248248
})
249249
},
250-
ExprKind::MethodCall(path, _, args) if args.len() == 1 => {
250+
ExprKind::MethodCall(path, _, args, _) if args.len() == 1 => {
251251
let type_of_receiver = cx.tables.expr_ty(&args[0]);
252252
if !is_type_diagnostic_item(cx, type_of_receiver, sym!(option_type))
253253
&& !is_type_diagnostic_item(cx, type_of_receiver, sym!(result_type))

clippy_lints/src/bytecount.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ declare_lint_pass!(ByteCount => [NAIVE_BYTECOUNT]);
3838
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for ByteCount {
3939
fn check_expr(&mut self, cx: &LateContext<'_, '_>, expr: &Expr<'_>) {
4040
if_chain! {
41-
if let ExprKind::MethodCall(ref count, _, ref count_args) = expr.kind;
41+
if let ExprKind::MethodCall(ref count, _, ref count_args, _) = expr.kind;
4242
if count.ident.name == sym!(count);
4343
if count_args.len() == 1;
44-
if let ExprKind::MethodCall(ref filter, _, ref filter_args) = count_args[0].kind;
44+
if let ExprKind::MethodCall(ref filter, _, ref filter_args, _) = count_args[0].kind;
4545
if filter.ident.name == sym!(filter);
4646
if filter_args.len() == 2;
4747
if let ExprKind::Closure(_, _, body_id, _, _) = filter_args[1].kind;
@@ -66,7 +66,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for ByteCount {
6666
if ty::Uint(UintTy::U8) != walk_ptrs_ty(cx.tables.expr_ty(needle)).kind {
6767
return;
6868
}
69-
let haystack = if let ExprKind::MethodCall(ref path, _, ref args) =
69+
let haystack = if let ExprKind::MethodCall(ref path, _, ref args, _) =
7070
filter_args[0].kind {
7171
let p = path.ident.name;
7272
if (p == sym!(iter) || p == sym!(iter_mut)) && args.len() == 1 {

clippy_lints/src/checked_conversions.rs

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ fn double_check<'a>(cx: &LateContext<'_, '_>, left: &'a Expr<'_>, right: &'a Exp
8888
let upper = check_upper_bound(l);
8989
let lower = check_lower_bound(r);
9090

91-
transpose(upper, lower).and_then(|(l, r)| l.combine(r, cx))
91+
upper.zip(lower).and_then(|(l, r)| l.combine(r, cx))
9292
};
9393

9494
upper_lower(left, right).or_else(|| upper_lower(right, left))
@@ -131,7 +131,10 @@ impl<'a> Conversion<'a> {
131131

132132
/// Checks if the to-type is the same (if there is a type constraint)
133133
fn has_compatible_to_type(&self, other: &Self) -> bool {
134-
transpose(self.to_type.as_ref(), other.to_type.as_ref()).map_or(true, |(l, r)| l == r)
134+
match (self.to_type, other.to_type) {
135+
(Some(l), Some(r)) => l == r,
136+
_ => true,
137+
}
135138
}
136139

137140
/// Try to construct a new conversion if the conversion type is valid
@@ -322,14 +325,6 @@ fn int_ty_to_sym<'tcx>(path: &QPath<'_>) -> Option<&'tcx str> {
322325
}
323326
}
324327

325-
/// (Option<T>, Option<U>) -> Option<(T, U)>
326-
fn transpose<T, U>(lhs: Option<T>, rhs: Option<U>) -> Option<(T, U)> {
327-
match (lhs, rhs) {
328-
(Some(l), Some(r)) => Some((l, r)),
329-
_ => None,
330-
}
331-
}
332-
333328
/// Will return the expressions as if they were expr1 <= expr2
334329
fn normalize_le_ge<'a>(op: &BinOp, left: &'a Expr<'a>, right: &'a Expr<'a>) -> Option<(&'a Expr<'a>, &'a Expr<'a>)> {
335330
match op.node {

clippy_lints/src/consts.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -254,11 +254,11 @@ impl<'c, 'cc> ConstEvalLateContext<'c, 'cc> {
254254
if let ["core", "num", int_impl, "max_value"] = *def_path;
255255
then {
256256
let value = match int_impl {
257-
"<impl i8>" => i8::max_value() as u128,
258-
"<impl i16>" => i16::max_value() as u128,
259-
"<impl i32>" => i32::max_value() as u128,
260-
"<impl i64>" => i64::max_value() as u128,
261-
"<impl i128>" => i128::max_value() as u128,
257+
"<impl i8>" => i8::MAX as u128,
258+
"<impl i16>" => i16::MAX as u128,
259+
"<impl i32>" => i32::MAX as u128,
260+
"<impl i64>" => i64::MAX as u128,
261+
"<impl i128>" => i128::MAX as u128,
262262
_ => return None,
263263
};
264264
Some(Constant::Int(value))

clippy_lints/src/dereference.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Dereferencing {
4242
fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr<'_>) {
4343
if_chain! {
4444
if !expr.span.from_expansion();
45-
if let ExprKind::MethodCall(ref method_name, _, ref args) = &expr.kind;
45+
if let ExprKind::MethodCall(ref method_name, _, ref args, _) = &expr.kind;
4646
if args.len() == 1;
4747

4848
then {

clippy_lints/src/double_parens.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ impl EarlyLintPass for DoubleParens {
7070
}
7171
}
7272
},
73-
ExprKind::MethodCall(_, ref params) => {
73+
ExprKind::MethodCall(_, ref params, _) => {
7474
if params.len() == 2 {
7575
let param = &params[1];
7676
if let ExprKind::Paren(_) = param.kind {

clippy_lints/src/duration_subsec.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for DurationSubsec {
4242
fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr<'_>) {
4343
if_chain! {
4444
if let ExprKind::Binary(Spanned { node: BinOpKind::Div, .. }, ref left, ref right) = expr.kind;
45-
if let ExprKind::MethodCall(ref method_path, _ , ref args) = left.kind;
45+
if let ExprKind::MethodCall(ref method_path, _ , ref args, _) = left.kind;
4646
if match_type(cx, walk_ptrs_ty(cx.tables.expr_ty(&args[0])), &paths::DURATION);
4747
if let Some((Constant::Int(divisor), _)) = constant(cx, cx.tables, right);
4848
then {

clippy_lints/src/entry.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ fn check_cond<'a, 'tcx, 'b>(
103103
check: &'b Expr<'b>,
104104
) -> Option<(&'static str, &'b Expr<'b>, &'b Expr<'b>)> {
105105
if_chain! {
106-
if let ExprKind::MethodCall(ref path, _, ref params) = check.kind;
106+
if let ExprKind::MethodCall(ref path, _, ref params, _) = check.kind;
107107
if params.len() >= 2;
108108
if path.ident.name == sym!(contains_key);
109109
if let ExprKind::AddrOf(BorrowKind::Ref, _, ref key) = params[1].kind;
@@ -140,7 +140,7 @@ impl<'a, 'tcx, 'b> Visitor<'tcx> for InsertVisitor<'a, 'tcx, 'b> {
140140

141141
fn visit_expr(&mut self, expr: &'tcx Expr<'_>) {
142142
if_chain! {
143-
if let ExprKind::MethodCall(ref path, _, ref params) = expr.kind;
143+
if let ExprKind::MethodCall(ref path, _, ref params, _) = expr.kind;
144144
if params.len() == 3;
145145
if path.ident.name == sym!(insert);
146146
if get_item_name(self.cx, self.map) == get_item_name(self.cx, &params[0]);

clippy_lints/src/enum_clike.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnportableVariant {
6565
continue;
6666
}
6767
},
68-
ty::Uint(UintTy::Usize) if val > u128::from(u32::max_value()) => {},
68+
ty::Uint(UintTy::Usize) if val > u128::from(u32::MAX) => {},
6969
_ => continue,
7070
}
7171
span_lint(

0 commit comments

Comments
 (0)