@@ -61,7 +61,7 @@ fn is_impl_not_trait_with_bool_out<'tcx>(cx: &LateContext<'tcx>, ty: Ty<'tcx>) -
61
61
)
62
62
} )
63
63
. map_or ( false , |assoc_item| {
64
- let proj = cx. tcx . mk_projection ( assoc_item. def_id , cx. tcx . mk_substs_trait ( ty, [ ] ) ) ;
64
+ let proj = Ty :: new_projection ( cx. tcx , assoc_item. def_id , cx. tcx . mk_substs_trait ( ty, [ ] ) ) ;
65
65
let nty = cx. tcx . normalize_erasing_regions ( cx. param_env , proj) ;
66
66
67
67
nty. is_bool ( )
@@ -70,14 +70,18 @@ fn is_impl_not_trait_with_bool_out<'tcx>(cx: &LateContext<'tcx>, ty: Ty<'tcx>) -
70
70
71
71
impl < ' tcx > LateLintPass < ' tcx > for BoolAssertComparison {
72
72
fn check_expr ( & mut self , cx : & LateContext < ' tcx > , expr : & ' tcx Expr < ' _ > ) {
73
- let Some ( macro_call) = root_macro_call_first_node ( cx, expr) else { return } ;
73
+ let Some ( macro_call) = root_macro_call_first_node ( cx, expr) else {
74
+ return ;
75
+ } ;
74
76
let macro_name = cx. tcx . item_name ( macro_call. def_id ) ;
75
77
let eq_macro = match macro_name. as_str ( ) {
76
78
"assert_eq" | "debug_assert_eq" => true ,
77
79
"assert_ne" | "debug_assert_ne" => false ,
78
80
_ => return ,
79
81
} ;
80
- let Some ( ( a, b, _) ) = find_assert_eq_args ( cx, expr, macro_call. expn ) else { return } ;
82
+ let Some ( ( a, b, _) ) = find_assert_eq_args ( cx, expr, macro_call. expn ) else {
83
+ return ;
84
+ } ;
81
85
82
86
let a_span = a. span . source_callsite ( ) ;
83
87
let b_span = b. span . source_callsite ( ) ;
@@ -126,7 +130,9 @@ impl<'tcx> LateLintPass<'tcx> for BoolAssertComparison {
126
130
let mut suggestions = vec ! [ ( name_span, non_eq_mac. to_string( ) ) , ( lit_span, String :: new( ) ) ] ;
127
131
128
132
if bool_value ^ eq_macro {
129
- let Some ( sugg) = Sugg :: hir_opt ( cx, non_lit_expr) else { return } ;
133
+ let Some ( sugg) = Sugg :: hir_opt ( cx, non_lit_expr) else {
134
+ return ;
135
+ } ;
130
136
suggestions. push ( ( non_lit_expr. span , ( !sugg) . to_string ( ) ) ) ;
131
137
}
132
138
0 commit comments