@@ -31,8 +31,7 @@ pub fn expr_type_is_certain(cx: &LateContext<'_>, expr: &Expr<'_>) -> bool {
31
31
32
32
fn expr_type_certainty ( cx : & LateContext < ' _ > , expr : & Expr < ' _ > ) -> Certainty {
33
33
let certainty = match & expr. kind {
34
- ExprKind :: Box ( expr)
35
- | ExprKind :: Unary ( _, expr)
34
+ ExprKind :: Unary ( _, expr)
36
35
| ExprKind :: Field ( expr, _)
37
36
| ExprKind :: Index ( expr, _)
38
37
| ExprKind :: AddrOf ( _, _, expr) => expr_type_certainty ( cx, expr) ,
@@ -170,8 +169,7 @@ fn qpath_certainty(cx: &LateContext<'_>, qpath: &QPath<'_>, resolves_to_type: bo
170
169
QPath :: LangItem ( lang_item, _, _) => {
171
170
cx. tcx
172
171
. lang_items ( )
173
- . require ( * lang_item)
174
- . ok ( )
172
+ . get ( * lang_item)
175
173
. map_or ( Certainty :: Uncertain , |def_id| {
176
174
let generics = cx. tcx . generics_of ( def_id) ;
177
175
if generics. parent_count == 0 && generics. params . is_empty ( ) {
@@ -230,8 +228,8 @@ fn path_segment_certainty(
230
228
Certainty :: Certain ( None )
231
229
} ,
232
230
233
- // `get_parent_node ` because `hir_id` refers to a `Pat`, and we're interested in the node containing the `Pat`.
234
- Res :: Local ( hir_id) => match cx. tcx . hir ( ) . get ( cx . tcx . hir ( ) . get_parent_node ( hir_id) ) {
231
+ // `get_parent ` because `hir_id` refers to a `Pat`, and we're interested in the node containing the `Pat`.
232
+ Res :: Local ( hir_id) => match cx. tcx . hir ( ) . get_parent ( hir_id) {
235
233
// An argument's type is always certain.
236
234
Node :: Param ( ..) => Certainty :: Certain ( None ) ,
237
235
// A local's type is certain if its type annotation is certain or it has an initializer whose
@@ -292,7 +290,7 @@ fn type_is_inferrable_from_arguments(cx: &LateContext<'_>, expr: &Expr<'_>) -> b
292
290
293
291
( 0 ..( generics. parent_count + generics. params . len ( ) ) as u32 ) . all ( |index| {
294
292
fn_sig. inputs ( ) . iter ( ) . any ( |input_ty| {
295
- input_ty. walk ( ) . any ( |arg| {
293
+ input_ty. skip_binder ( ) . walk ( ) . any ( |arg| {
296
294
if let GenericArgKind :: Type ( ty) = arg. unpack ( ) {
297
295
ty. is_param ( index)
298
296
} else {
@@ -304,7 +302,7 @@ fn type_is_inferrable_from_arguments(cx: &LateContext<'_>, expr: &Expr<'_>) -> b
304
302
}
305
303
306
304
fn self_ty < ' tcx > ( cx : & LateContext < ' tcx > , method_def_id : DefId ) -> Ty < ' tcx > {
307
- cx. tcx . fn_sig ( method_def_id) . skip_binder ( ) . inputs ( ) [ 0 ]
305
+ cx. tcx . fn_sig ( method_def_id) . skip_binder ( ) . inputs ( ) . skip_binder ( ) [ 0 ]
308
306
}
309
307
310
308
fn adt_def_id ( ty : Ty < ' _ > ) -> Option < DefId > {
0 commit comments