defs::Definition,
search::{FileReference, SearchScope, UsageSearchResult},
};
-use itertools::Itertools;
use syntax::{
ast::{self, AstNode, FieldExpr, HasName, IdentPat, MethodCallExpr},
TextRange,
let usages = ctx.sema.to_def(&ident_pat).map(|def| {
Definition::Local(def)
.usages(&ctx.sema)
- .in_scope(SearchScope::single_file(ctx.frange.file_id))
+ .in_scope(SearchScope::single_file(ctx.file_id()))
.all()
});
let field_names = (0..field_types.len())
.map(|i| generate_name(ctx, i, &name, &ident_pat, &usages))
- .collect_vec();
+ .collect::<Vec<_>>();
Some(TupleData { ident_pat, range, ref_type, field_names, usages })
}
// with sub_pattern: keep original tuple and add subpattern: `tup @ (_0, _1)`
if in_sub_pattern {
- let text = format!(" @ {}", tuple_pat.to_string());
+ let text = format!(" @ {}", tuple_pat);
match ctx.config.snippet_cap {
Some(cap) => {
let snip = add_cursor(&text);