@@ -22,22 +22,17 @@ pub(super) fn check(cx: &LateContext<'_>, recv: &hir::Expr<'_>, method_name: Sym
22
22
if let ty:: Adt ( adt, generic_args) = recv_ty. kind ( )
23
23
// `name_of_generic`, is e.g. a `sym::Option`
24
24
&& let Some ( name_of_generic) = cx. tcx . get_diagnostic_name ( adt. did ( ) )
25
- && let Some ( ( message, suggestion) ) = CONCEALING_METHODS . into_iter ( ) . find_map ( |concealing| {
26
- ( name_of_generic == concealing. ty && method_name == concealing. method )
27
- . then ( || {
28
- generic_args. get ( concealing. generic_index ) . and_then ( |entry| {
29
- entry. as_type ( ) . and_then ( |ty| {
30
- extract_obvious_default ( cx, ty) . map ( |( default, ty) | {
31
- let method = ( concealing. fmt_msg ) ( ty) ;
32
- (
33
- format ! ( "method {method} conceals the underlying type" ) ,
34
- ( concealing. fmt_sugg ) ( default) ,
35
- )
36
- } )
37
- } )
38
- } )
39
- } )
40
- . flatten ( )
25
+ && let Some ( ( message, suggestion) ) = CONCEALING_METHODS . into_iter ( ) . find ( |concealing| {
26
+ name_of_generic == concealing. ty && method_name == concealing. method
27
+ } ) . and_then ( |concealing| {
28
+ let ty = generic_args. type_at ( concealing. generic_index ) ;
29
+ extract_obvious_default ( cx, ty) . map ( |( default, ty) | {
30
+ let method = ( concealing. fmt_msg ) ( ty) ;
31
+ (
32
+ format ! ( "method {method} conceals the underlying type" ) ,
33
+ ( concealing. fmt_sugg ) ( default) ,
34
+ )
35
+ } )
41
36
} )
42
37
{
43
38
span_lint_and_sugg (
0 commit comments