let ty = sema.type_of_expr(&expr_behind_ref)?.adjusted();
let scope = sema.scope(iterable.syntax());
let krate = scope.module()?.krate();
- let traits_in_scope = scope.traits_in_scope();
+ let traits_in_scope = scope.visible_traits();
let iter_trait = FamousDefs(sema, Some(krate)).core_iter_Iterator()?;
let has_wanted_method = ty
sema.db,
krate,
&traits_in_scope,
+ None,
Some(&wanted_method),
|_, func| {
if func.ret_type(sema.db).impls_trait(sema.db, iter_trait, &[]) {
expr: ast::MethodCallExpr,
) -> Option<(ast::Expr, ast::Expr)> {
let name_ref = expr.name_ref()?;
- if name_ref.syntax().text_range().intersect(ctx.frange.range).is_none() {
+ if !name_ref.syntax().text_range().contains_range(ctx.selection_trimmed()) {
cov_mark::hit!(test_for_each_not_applicable_invalid_cursor_pos);
return None;
}