We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 91a09f5 commit 3cadba4Copy full SHA for 3cadba4
crates/ide/src/inlay_hints.rs
@@ -254,10 +254,11 @@ fn should_not_display_type_hint(
254
ast::ForExpr(it) => {
255
// We *should* display hint only if user provided "in {expr}" and we know the type of expr (and it's not unit).
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;
+ return it.in_token().is_none() ||
+ it.iterable()
+ .and_then(|iterable_expr|sema.type_of_expr(&iterable_expr))
+ .map(|iterable_ty| iterable_ty.is_unknown() || iterable_ty.is_unit())
261
+ .unwrap_or(true)
262
},
263
_ => (),
264
}
0 commit comments