From a0fc649269bda6c01f1b22d233ebb49cb34925a3 Mon Sep 17 00:00:00 2001 From: Lukas Wirth Date: Sat, 7 May 2022 15:08:33 +0200 Subject: [PATCH] fix unreachable pub --- crates/ide-completion/src/completions/mod_.rs | 4 ++-- crates/ide-completion/src/context.rs | 6 ++---- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/crates/ide-completion/src/completions/mod_.rs b/crates/ide-completion/src/completions/mod_.rs index 3ba663067a..827d9f85ef 100644 --- a/crates/ide-completion/src/completions/mod_.rs +++ b/crates/ide-completion/src/completions/mod_.rs @@ -14,7 +14,7 @@ use crate::{ CompletionItem, Completions, }; -/// Complete mod declaration, i.e. `mod ;` +/// Complete mod declaration, i.e. `mod $0;` pub(crate) fn complete_mod(acc: &mut Completions, ctx: &CompletionContext) -> Option<()> { let mod_under_caret = match ctx.name_ctx() { Some(NameContext { kind: NameKind::Module(mod_under_caret), .. }) @@ -28,7 +28,7 @@ pub(crate) fn complete_mod(acc: &mut Completions, ctx: &CompletionContext) -> Op let _p = profile::span("completion::complete_mod"); let mut current_module = ctx.module; - // For `mod `, `ctx.module` is its parent, but for `mod f`, it's `mod f` itself, but we're + // For `mod $0`, `ctx.module` is its parent, but for `mod f$0`, it's `mod f` itself, but we're // interested in its parent. if ctx.original_token.kind() == SyntaxKind::IDENT { if let Some(module) = ctx.original_token.ancestors().nth(1).and_then(ast::Module::cast) { diff --git a/crates/ide-completion/src/context.rs b/crates/ide-completion/src/context.rs index 1381e87031..5342c481e3 100644 --- a/crates/ide-completion/src/context.rs +++ b/crates/ide-completion/src/context.rs @@ -123,7 +123,7 @@ pub(super) struct LifetimeContext { } #[derive(Debug)] -pub enum LifetimeKind { +pub(super) enum LifetimeKind { LifetimeParam { is_decl: bool, param: ast::LifetimeParam }, Lifetime, LabelRef, @@ -131,7 +131,7 @@ pub enum LifetimeKind { } #[derive(Debug)] -pub struct NameContext { +pub(super) struct NameContext { #[allow(dead_code)] pub(super) name: Option, pub(super) kind: NameKind, @@ -534,9 +534,7 @@ impl<'a> CompletionContext<'a> { file_with_fake_ident.syntax().token_at_offset(offset).right_biased()?; let original_token = original_file.syntax().token_at_offset(offset).left_biased()?; - dbg!(&original_token); let token = sema.descend_into_macros_single(original_token.clone()); - dbg!(&token); let scope = sema.scope_at_offset(&token.parent()?, offset)?; let krate = scope.krate(); let module = scope.module();