Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/ide-assists/src/handlers/convert_closure_to_fn.rs')
| -rw-r--r-- | crates/ide-assists/src/handlers/convert_closure_to_fn.rs | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/crates/ide-assists/src/handlers/convert_closure_to_fn.rs b/crates/ide-assists/src/handlers/convert_closure_to_fn.rs index fbd925e55e..1d3a2db335 100644 --- a/crates/ide-assists/src/handlers/convert_closure_to_fn.rs +++ b/crates/ide-assists/src/handlers/convert_closure_to_fn.rs @@ -249,7 +249,7 @@ pub(crate) fn convert_closure_to_fn(acc: &mut Assists, ctx: &AssistContext<'_>) ); fn_ = fn_.dedent(IndentLevel::from_token(&fn_.syntax().last_token().unwrap())); - builder.edit_file(ctx.file_id()); + builder.edit_file(ctx.vfs_file_id()); match &closure_name { Some((closure_decl, _, _)) => { fn_ = fn_.indent(closure_decl.indent_level()); @@ -506,9 +506,8 @@ fn wrap_capture_in_deref_if_needed( } fn capture_as_arg(ctx: &AssistContext<'_>, capture: &ClosureCapture) -> ast::Expr { - let place = - parse_expr_from_str(&capture.display_place_source_code(ctx.db()), ctx.file_id().edition()) - .expect("`display_place_source_code()` produced an invalid expr"); + let place = parse_expr_from_str(&capture.display_place_source_code(ctx.db()), ctx.edition()) + .expect("`display_place_source_code()` produced an invalid expr"); let needs_mut = match capture.kind() { CaptureKind::SharedRef => false, CaptureKind::MutableRef | CaptureKind::UniqueSharedRef => true, @@ -587,7 +586,7 @@ fn handle_call( let indent = if insert_newlines { first_arg_indent.unwrap().to_string() } else { String::new() }; // FIXME: This text manipulation seems risky. - let text = ctx.db().file_text(file_id.file_id()).text(ctx.db()); + let text = ctx.db().file_text(file_id.file_id(ctx.db())).text(ctx.db()); let mut text = text[..u32::from(range.end()).try_into().unwrap()].trim_end(); if !text.ends_with(')') { return None; @@ -630,7 +629,7 @@ fn handle_call( to_insert.push(','); } - builder.edit_file(file_id); + builder.edit_file(file_id.file_id(ctx.db())); builder.insert(offset, to_insert); Some(()) |