diff options
author | Aleksey Kladov <[email protected]> | 2019-10-30 10:10:38 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2019-10-30 10:11:38 +0000 |
commit | c9cd6aa370667783292de3bc580e0503a409e453 (patch) | |
tree | 4662b1c76bed5e830c1dae9ee5dbf47520f41e1e /crates/ra_ide_api | |
parent | a136cc0653d2b4133fb6387009cfdbaf3e2cf275 (diff) |
Move ids to hir_def crate
Diffstat (limited to 'crates/ra_ide_api')
-rw-r--r-- | crates/ra_ide_api/src/completion/complete_path.rs | 2 | ||||
-rw-r--r-- | crates/ra_ide_api/src/impls.rs | 4 | ||||
-rw-r--r-- | crates/ra_ide_api/src/parent_module.rs | 5 | ||||
-rw-r--r-- | crates/ra_ide_api/src/references/search_scope.rs | 2 |
4 files changed, 5 insertions, 8 deletions
diff --git a/crates/ra_ide_api/src/completion/complete_path.rs b/crates/ra_ide_api/src/completion/complete_path.rs index 23dece73c..956d8ce49 100644 --- a/crates/ra_ide_api/src/completion/complete_path.rs +++ b/crates/ra_ide_api/src/completion/complete_path.rs | |||
@@ -50,7 +50,7 @@ pub(super) fn complete_path(acc: &mut Completions, ctx: &CompletionContext) { | |||
50 | hir::ModuleDef::TypeAlias(a) => a.ty(ctx.db), | 50 | hir::ModuleDef::TypeAlias(a) => a.ty(ctx.db), |
51 | _ => unreachable!(), | 51 | _ => unreachable!(), |
52 | }; | 52 | }; |
53 | let krate = ctx.module.and_then(|m| m.krate(ctx.db)); | 53 | let krate = ctx.module.map(|m| m.krate()); |
54 | if let Some(krate) = krate { | 54 | if let Some(krate) = krate { |
55 | ty.iterate_impl_items(ctx.db, krate, |item| { | 55 | ty.iterate_impl_items(ctx.db, krate, |item| { |
56 | match item { | 56 | match item { |
diff --git a/crates/ra_ide_api/src/impls.rs b/crates/ra_ide_api/src/impls.rs index 7fc1b1efa..b899ed3a5 100644 --- a/crates/ra_ide_api/src/impls.rs +++ b/crates/ra_ide_api/src/impls.rs | |||
@@ -51,7 +51,7 @@ fn impls_for_def( | |||
51 | } | 51 | } |
52 | }; | 52 | }; |
53 | 53 | ||
54 | let krate = module.krate(db)?; | 54 | let krate = module.krate(); |
55 | let impls = db.impls_in_crate(krate); | 55 | let impls = db.impls_in_crate(krate); |
56 | 56 | ||
57 | Some( | 57 | Some( |
@@ -72,7 +72,7 @@ fn impls_for_trait( | |||
72 | let src = hir::Source { file_id: position.file_id.into(), ast: node.clone() }; | 72 | let src = hir::Source { file_id: position.file_id.into(), ast: node.clone() }; |
73 | let tr = hir::Trait::from_source(db, src)?; | 73 | let tr = hir::Trait::from_source(db, src)?; |
74 | 74 | ||
75 | let krate = module.krate(db)?; | 75 | let krate = module.krate(); |
76 | let impls = db.impls_in_crate(krate); | 76 | let impls = db.impls_in_crate(krate); |
77 | 77 | ||
78 | Some( | 78 | Some( |
diff --git a/crates/ra_ide_api/src/parent_module.rs b/crates/ra_ide_api/src/parent_module.rs index 566509849..4c57566e2 100644 --- a/crates/ra_ide_api/src/parent_module.rs +++ b/crates/ra_ide_api/src/parent_module.rs | |||
@@ -27,10 +27,7 @@ pub(crate) fn crate_for(db: &RootDatabase, file_id: FileId) -> Vec<CrateId> { | |||
27 | Some(it) => it, | 27 | Some(it) => it, |
28 | None => return Vec::new(), | 28 | None => return Vec::new(), |
29 | }; | 29 | }; |
30 | let krate = match module.krate(db) { | 30 | let krate = module.krate(); |
31 | Some(it) => it, | ||
32 | None => return Vec::new(), | ||
33 | }; | ||
34 | vec![krate.crate_id()] | 31 | vec![krate.crate_id()] |
35 | } | 32 | } |
36 | 33 | ||
diff --git a/crates/ra_ide_api/src/references/search_scope.rs b/crates/ra_ide_api/src/references/search_scope.rs index b6eb248b7..dbd1af597 100644 --- a/crates/ra_ide_api/src/references/search_scope.rs +++ b/crates/ra_ide_api/src/references/search_scope.rs | |||
@@ -120,7 +120,7 @@ impl NameDefinition { | |||
120 | return SearchScope::new(res); | 120 | return SearchScope::new(res); |
121 | } | 121 | } |
122 | if vis.as_str() == "pub" { | 122 | if vis.as_str() == "pub" { |
123 | let krate = self.container.krate(db).unwrap(); | 123 | let krate = self.container.krate(); |
124 | let crate_graph = db.crate_graph(); | 124 | let crate_graph = db.crate_graph(); |
125 | for crate_id in crate_graph.iter() { | 125 | for crate_id in crate_graph.iter() { |
126 | let mut crate_deps = crate_graph.dependencies(crate_id); | 126 | let mut crate_deps = crate_graph.dependencies(crate_id); |