Skip to content

Commit 08e044e

Browse files
committed
Fix sync fallout
1 parent d5ea1d6 commit 08e044e

File tree

4 files changed

+22
-49
lines changed

4 files changed

+22
-49
lines changed

clippy_lints/src/len_zero.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,8 @@ fn check_impl_items(cx: &LateContext<'_, '_>, item: &Item<'_>, impl_items: &[Imp
211211
}
212212

213213
fn check_cmp(cx: &LateContext<'_, '_>, span: Span, method: &Expr<'_>, lit: &Expr<'_>, op: &str, compare_to: u32) {
214-
if let (&ExprKind::MethodCall(ref method_path, _, ref args, _), &ExprKind::Lit(ref lit)) = (&method.kind, &lit.kind) {
214+
if let (&ExprKind::MethodCall(ref method_path, _, ref args, _), &ExprKind::Lit(ref lit)) = (&method.kind, &lit.kind)
215+
{
215216
// check if we are in an is_empty() method
216217
if let Some(name) = get_item_name(cx, method) {
217218
if name.as_str() == "is_empty" {

clippy_lints/src/types.rs

+12-46
Original file line numberDiff line numberDiff line change
@@ -1945,16 +1945,12 @@ fn detect_extreme_expr<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr<'_
19451945

19461946
let which = match (&ty.kind, cv) {
19471947
(&ty::Bool, Constant::Bool(false)) | (&ty::Uint(_), Constant::Int(0)) => Minimum,
1948-
(&ty::Int(ity), Constant::Int(i))
1949-
if i == unsext(cx.tcx, i128::MIN >> (128 - int_bits(cx.tcx, ity)), ity) =>
1950-
{
1948+
(&ty::Int(ity), Constant::Int(i)) if i == unsext(cx.tcx, i128::MIN >> (128 - int_bits(cx.tcx, ity)), ity) => {
19511949
Minimum
19521950
},
19531951

19541952
(&ty::Bool, Constant::Bool(true)) => Maximum,
1955-
(&ty::Int(ity), Constant::Int(i))
1956-
if i == unsext(cx.tcx, i128::MAX >> (128 - int_bits(cx.tcx, ity)), ity) =>
1957-
{
1953+
(&ty::Int(ity), Constant::Int(i)) if i == unsext(cx.tcx, i128::MAX >> (128 - int_bits(cx.tcx, ity)), ity) => {
19581954
Maximum
19591955
},
19601956
(&ty::Uint(uty), Constant::Int(i)) if clip(cx.tcx, u128::MAX, uty) == i => Maximum,
@@ -2083,50 +2079,20 @@ fn numeric_cast_precast_bounds<'a>(cx: &LateContext<'_, '_>, expr: &'a Expr<'_>)
20832079
}
20842080
match pre_cast_ty.kind {
20852081
ty::Int(int_ty) => Some(match int_ty {
2086-
IntTy::I8 => (
2087-
FullInt::S(i128::from(i8::MIN)),
2088-
FullInt::S(i128::from(i8::MAX)),
2089-
),
2090-
IntTy::I16 => (
2091-
FullInt::S(i128::from(i16::MIN)),
2092-
FullInt::S(i128::from(i16::MAX)),
2093-
),
2094-
IntTy::I32 => (
2095-
FullInt::S(i128::from(i32::MIN)),
2096-
FullInt::S(i128::from(i32::MAX)),
2097-
),
2098-
IntTy::I64 => (
2099-
FullInt::S(i128::from(i64::MIN)),
2100-
FullInt::S(i128::from(i64::MAX)),
2101-
),
2082+
IntTy::I8 => (FullInt::S(i128::from(i8::MIN)), FullInt::S(i128::from(i8::MAX))),
2083+
IntTy::I16 => (FullInt::S(i128::from(i16::MIN)), FullInt::S(i128::from(i16::MAX))),
2084+
IntTy::I32 => (FullInt::S(i128::from(i32::MIN)), FullInt::S(i128::from(i32::MAX))),
2085+
IntTy::I64 => (FullInt::S(i128::from(i64::MIN)), FullInt::S(i128::from(i64::MAX))),
21022086
IntTy::I128 => (FullInt::S(i128::MIN), FullInt::S(i128::MAX)),
2103-
IntTy::Isize => (
2104-
FullInt::S(isize::MIN as i128),
2105-
FullInt::S(isize::MAX as i128),
2106-
),
2087+
IntTy::Isize => (FullInt::S(isize::MIN as i128), FullInt::S(isize::MAX as i128)),
21072088
}),
21082089
ty::Uint(uint_ty) => Some(match uint_ty {
2109-
UintTy::U8 => (
2110-
FullInt::U(u128::from(u8::MIN)),
2111-
FullInt::U(u128::from(u8::MAX)),
2112-
),
2113-
UintTy::U16 => (
2114-
FullInt::U(u128::from(u16::MIN)),
2115-
FullInt::U(u128::from(u16::MAX)),
2116-
),
2117-
UintTy::U32 => (
2118-
FullInt::U(u128::from(u32::MIN)),
2119-
FullInt::U(u128::from(u32::MAX)),
2120-
),
2121-
UintTy::U64 => (
2122-
FullInt::U(u128::from(u64::MIN)),
2123-
FullInt::U(u128::from(u64::MAX)),
2124-
),
2090+
UintTy::U8 => (FullInt::U(u128::from(u8::MIN)), FullInt::U(u128::from(u8::MAX))),
2091+
UintTy::U16 => (FullInt::U(u128::from(u16::MIN)), FullInt::U(u128::from(u16::MAX))),
2092+
UintTy::U32 => (FullInt::U(u128::from(u32::MIN)), FullInt::U(u128::from(u32::MAX))),
2093+
UintTy::U64 => (FullInt::U(u128::from(u64::MIN)), FullInt::U(u128::from(u64::MAX))),
21252094
UintTy::U128 => (FullInt::U(u128::MIN), FullInt::U(u128::MAX)),
2126-
UintTy::Usize => (
2127-
FullInt::U(usize::MIN as u128),
2128-
FullInt::U(usize::MAX as u128),
2129-
),
2095+
UintTy::Usize => (FullInt::U(usize::MIN as u128), FullInt::U(usize::MAX as u128)),
21302096
}),
21312097
_ => None,
21322098
}

clippy_lints/src/unnecessary_sort_by.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,10 @@ fn mirrored_exprs(
9595
// The two exprs are method calls.
9696
// Check to see that the function is the same and the arguments are mirrored
9797
// This is enough because the receiver of the method is listed in the arguments
98-
(ExprKind::MethodCall(left_segment, _, left_args, _), ExprKind::MethodCall(right_segment, _, right_args, _)) => {
98+
(
99+
ExprKind::MethodCall(left_segment, _, left_args, _),
100+
ExprKind::MethodCall(right_segment, _, right_args, _),
101+
) => {
99102
left_segment.ident == right_segment.ident
100103
&& left_args
101104
.iter()

clippy_lints/src/utils/author.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,10 @@ impl<'tcx> Visitor<'tcx> for PrintVisitor {
251251
}
252252
},
253253
ExprKind::MethodCall(ref _method_name, ref _generics, ref _args, ref _fn_span) => {
254-
println!("MethodCall(ref method_name, ref generics, ref args, ref fn_span) = {};", current);
254+
println!(
255+
"MethodCall(ref method_name, ref generics, ref args, ref fn_span) = {};",
256+
current
257+
);
255258
println!(" // unimplemented: `ExprKind::MethodCall` is not further destructured at the moment");
256259
},
257260
ExprKind::Tup(ref elements) => {

0 commit comments

Comments
 (0)