diff options
author | Aleksey Kladov <[email protected]> | 2020-03-13 16:58:49 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2020-03-13 16:58:49 +0000 |
commit | 687bec117c0a59dc58daf5c9954c906eeb60de21 (patch) | |
tree | 8c6ee929ffa9f820e98b1b661e2ef7ddcf4d5b32 | |
parent | 4c85e53531fc9e2e2c2f1368c01e08e10e190cd5 (diff) |
Don't use generic DB where a concrete one will do
-rw-r--r-- | crates/ra_assists/src/handlers/fill_match_arms.rs | 8 | ||||
-rw-r--r-- | crates/ra_ide/src/completion/presentation.rs | 9 |
2 files changed, 8 insertions, 9 deletions
diff --git a/crates/ra_assists/src/handlers/fill_match_arms.rs b/crates/ra_assists/src/handlers/fill_match_arms.rs index e5d8c639d..97cf90ae4 100644 --- a/crates/ra_assists/src/handlers/fill_match_arms.rs +++ b/crates/ra_assists/src/handlers/fill_match_arms.rs | |||
@@ -2,7 +2,7 @@ | |||
2 | 2 | ||
3 | use std::iter; | 3 | use std::iter; |
4 | 4 | ||
5 | use hir::{db::HirDatabase, Adt, HasSource, Semantics}; | 5 | use hir::{Adt, HasSource, Semantics}; |
6 | use ra_syntax::ast::{self, edit::IndentLevel, make, AstNode, NameOwner}; | 6 | use ra_syntax::ast::{self, edit::IndentLevel, make, AstNode, NameOwner}; |
7 | 7 | ||
8 | use crate::{Assist, AssistCtx, AssistId}; | 8 | use crate::{Assist, AssistCtx, AssistId}; |
@@ -88,11 +88,7 @@ fn resolve_enum_def(sema: &Semantics<RootDatabase>, expr: &ast::Expr) -> Option< | |||
88 | }) | 88 | }) |
89 | } | 89 | } |
90 | 90 | ||
91 | fn build_pat( | 91 | fn build_pat(db: &RootDatabase, module: hir::Module, var: hir::EnumVariant) -> Option<ast::Pat> { |
92 | db: &impl HirDatabase, | ||
93 | module: hir::Module, | ||
94 | var: hir::EnumVariant, | ||
95 | ) -> Option<ast::Pat> { | ||
96 | let path = crate::ast_transform::path_to_ast(module.find_use_path(db, var.into())?); | 92 | let path = crate::ast_transform::path_to_ast(module.find_use_path(db, var.into())?); |
97 | 93 | ||
98 | // FIXME: use HIR for this; it doesn't currently expose struct vs. tuple vs. unit variants though | 94 | // FIXME: use HIR for this; it doesn't currently expose struct vs. tuple vs. unit variants though |
diff --git a/crates/ra_ide/src/completion/presentation.rs b/crates/ra_ide/src/completion/presentation.rs index 910844244..253848602 100644 --- a/crates/ra_ide/src/completion/presentation.rs +++ b/crates/ra_ide/src/completion/presentation.rs | |||
@@ -1,6 +1,6 @@ | |||
1 | //! This modules takes care of rendering various definitions as completion items. | 1 | //! This modules takes care of rendering various definitions as completion items. |
2 | 2 | ||
3 | use hir::{db::HirDatabase, Docs, HasAttrs, HasSource, HirDisplay, ScopeDef, StructKind, Type}; | 3 | use hir::{Docs, HasAttrs, HasSource, HirDisplay, ScopeDef, StructKind, Type}; |
4 | use join_to_string::join; | 4 | use join_to_string::join; |
5 | use ra_syntax::ast::NameOwner; | 5 | use ra_syntax::ast::NameOwner; |
6 | use test_utils::tested_by; | 6 | use test_utils::tested_by; |
@@ -9,7 +9,10 @@ use crate::completion::{ | |||
9 | CompletionContext, CompletionItem, CompletionItemKind, CompletionKind, Completions, | 9 | CompletionContext, CompletionItem, CompletionItemKind, CompletionKind, Completions, |
10 | }; | 10 | }; |
11 | 11 | ||
12 | use crate::display::{const_label, macro_label, type_label, FunctionSignature}; | 12 | use crate::{ |
13 | display::{const_label, macro_label, type_label, FunctionSignature}, | ||
14 | RootDatabase, | ||
15 | }; | ||
13 | 16 | ||
14 | impl Completions { | 17 | impl Completions { |
15 | pub(crate) fn add_field( | 18 | pub(crate) fn add_field( |
@@ -300,7 +303,7 @@ impl Completions { | |||
300 | } | 303 | } |
301 | } | 304 | } |
302 | 305 | ||
303 | fn is_deprecated(node: impl HasAttrs, db: &impl HirDatabase) -> bool { | 306 | fn is_deprecated(node: impl HasAttrs, db: &RootDatabase) -> bool { |
304 | node.attrs(db).by_key("deprecated").exists() | 307 | node.attrs(db).by_key("deprecated").exists() |
305 | } | 308 | } |
306 | 309 | ||