File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -254,10 +254,11 @@ fn should_not_display_type_hint(
254
254
ast:: ForExpr ( it) => {
255
255
// We *should* display hint only if user provided "in {expr}" and we know the type of expr (and it's not unit).
256
256
// Type of expr should be iterable.
257
- let type_is_known = |ty: Option <hir:: Type >| ty. map( |ty| !ty. is_unit( ) && !ty. is_unknown( ) ) . unwrap_or( false ) ;
258
- let should_display = it. in_token( ) . is_some( )
259
- && it. iterable( ) . map( |expr| type_is_known( sema. type_of_expr( & expr) ) ) . unwrap_or( false ) ;
260
- return !should_display;
257
+ return it. in_token( ) . is_none( ) ||
258
+ it. iterable( )
259
+ . and_then( |iterable_expr|sema. type_of_expr( & iterable_expr) )
260
+ . map( |iterable_ty| iterable_ty. is_unknown( ) || iterable_ty. is_unit( ) )
261
+ . unwrap_or( true )
261
262
} ,
262
263
_ => ( ) ,
263
264
}
You can’t perform that action at this time.
0 commit comments