From 5b9f8e7e8e309eb77ec8129ffeb555ff1435cc0f Mon Sep 17 00:00:00 2001 From: BooksBaum <15612932+Booksbaum@users.noreply.github.com> Date: Tue, 10 Aug 2021 14:15:12 +0200 Subject: [PATCH] Fix errors from `rebase master` Note: 2nd Assist description is moved down: generated doc tests extracts now all tests (previously only the first one). But it uses the first `Assist` name -- which is the wrong one for the 2nd test. And 2nd assist is currently disabled -> would fail anyway. --- .../src/handlers/destructure_tuple_binding.rs | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/crates/ide_assists/src/handlers/destructure_tuple_binding.rs b/crates/ide_assists/src/handlers/destructure_tuple_binding.rs index 01a7d462d71..a1aa0a04572 100644 --- a/crates/ide_assists/src/handlers/destructure_tuple_binding.rs +++ b/crates/ide_assists/src/handlers/destructure_tuple_binding.rs @@ -28,9 +28,11 @@ use crate::assist_context::{AssistBuilder, AssistContext, Assists}; // let v = _0; // } // ``` -// -// -// And (currently disabled): +pub(crate) fn destructure_tuple_binding(acc: &mut Assists, ctx: &AssistContext) -> Option<()> { + destructure_tuple_binding_impl(acc, ctx, false) +} + +// And when `with_sub_pattern` enabled (currently disabled): // Assist: destructure_tuple_binding_in_sub_pattern // // Destructures tuple items in sub-pattern (after `@`). @@ -48,10 +50,6 @@ use crate::assist_context::{AssistBuilder, AssistContext, Assists}; // let v = _0; // } // ``` -pub(crate) fn destructure_tuple_binding(acc: &mut Assists, ctx: &AssistContext) -> Option<()> { - destructure_tuple_binding_impl(acc, ctx, false) -} - pub(crate) fn destructure_tuple_binding_impl( acc: &mut Assists, ctx: &AssistContext, @@ -96,7 +94,7 @@ fn collect_data(ident_pat: IdentPat, ctx: &AssistContext) -> Option { let ty = ctx.sema.type_of_pat(&ident_pat.clone().into())?; // might be reference - let ty = ty.strip_references(); + let ty = ty.adjusted().strip_references(); // must be tuple let field_types = ty.tuple_fields(ctx.db()); if field_types.is_empty() {