diff options
author | Aramis Razzaghipour <[email protected]> | 2021-05-24 00:42:06 +0100 |
---|---|---|
committer | Aramis Razzaghipour <[email protected]> | 2021-05-24 05:54:16 +0100 |
commit | c32428571c3fbf12bd4a4187c797488355416a18 (patch) | |
tree | 482c2a1a2a88554f1b1aed4417f3262233e96ab4 /crates/ide | |
parent | 4fd5248749202e0578d719bc5480171a85358836 (diff) |
Remove hir krate methods
Diffstat (limited to 'crates/ide')
-rw-r--r-- | crates/ide/src/inlay_hints.rs | 2 | ||||
-rw-r--r-- | crates/ide/src/runnables.rs | 2 | ||||
-rw-r--r-- | crates/ide/src/syntax_highlighting/highlight.rs | 18 |
3 files changed, 11 insertions, 11 deletions
diff --git a/crates/ide/src/inlay_hints.rs b/crates/ide/src/inlay_hints.rs index 960d169f4..0ada3f92b 100644 --- a/crates/ide/src/inlay_hints.rs +++ b/crates/ide/src/inlay_hints.rs | |||
@@ -219,7 +219,7 @@ fn hint_iterator( | |||
219 | ) -> Option<SmolStr> { | 219 | ) -> Option<SmolStr> { |
220 | let db = sema.db; | 220 | let db = sema.db; |
221 | let strukt = ty.strip_references().as_adt()?; | 221 | let strukt = ty.strip_references().as_adt()?; |
222 | let krate = strukt.krate(db); | 222 | let krate = strukt.module(db).krate(); |
223 | if krate != famous_defs.core()? { | 223 | if krate != famous_defs.core()? { |
224 | return None; | 224 | return None; |
225 | } | 225 | } |
diff --git a/crates/ide/src/runnables.rs b/crates/ide/src/runnables.rs index f76715d84..ce1c76f37 100644 --- a/crates/ide/src/runnables.rs +++ b/crates/ide/src/runnables.rs | |||
@@ -227,7 +227,7 @@ pub(crate) fn runnable_fn(sema: &Semantics<RootDatabase>, def: hir::Function) -> | |||
227 | let func = def.source(sema.db)?; | 227 | let func = def.source(sema.db)?; |
228 | let name_string = def.name(sema.db).to_string(); | 228 | let name_string = def.name(sema.db).to_string(); |
229 | 229 | ||
230 | let root = def.krate(sema.db)?.root_module(sema.db); | 230 | let root = def.module(sema.db).krate().root_module(sema.db); |
231 | 231 | ||
232 | let kind = if name_string == "main" && def.module(sema.db) == root { | 232 | let kind = if name_string == "main" && def.module(sema.db) == root { |
233 | RunnableKind::Bin | 233 | RunnableKind::Bin |
diff --git a/crates/ide/src/syntax_highlighting/highlight.rs b/crates/ide/src/syntax_highlighting/highlight.rs index 2d6d8d100..574a14429 100644 --- a/crates/ide/src/syntax_highlighting/highlight.rs +++ b/crates/ide/src/syntax_highlighting/highlight.rs | |||
@@ -287,7 +287,7 @@ fn highlight_def(db: &RootDatabase, krate: Option<hir::Crate>, def: Definition) | |||
287 | Definition::Macro(m) => { | 287 | Definition::Macro(m) => { |
288 | let mut h = Highlight::new(HlTag::Symbol(SymbolKind::Macro)); | 288 | let mut h = Highlight::new(HlTag::Symbol(SymbolKind::Macro)); |
289 | 289 | ||
290 | if m.krate(db) != krate { | 290 | if m.module(db).map(hir::Module::krate) != krate { |
291 | h |= HlMod::Foreign; | 291 | h |= HlMod::Foreign; |
292 | } | 292 | } |
293 | 293 | ||
@@ -296,7 +296,7 @@ fn highlight_def(db: &RootDatabase, krate: Option<hir::Crate>, def: Definition) | |||
296 | Definition::Field(field) => { | 296 | Definition::Field(field) => { |
297 | let mut h = Highlight::new(HlTag::Symbol(SymbolKind::Field)); | 297 | let mut h = Highlight::new(HlTag::Symbol(SymbolKind::Field)); |
298 | 298 | ||
299 | if Some(field.parent_def(db).krate(db)) != krate { | 299 | if Some(field.parent_def(db).module(db).krate()) != krate { |
300 | h |= HlMod::Foreign; | 300 | h |= HlMod::Foreign; |
301 | } | 301 | } |
302 | 302 | ||
@@ -335,7 +335,7 @@ fn highlight_def(db: &RootDatabase, krate: Option<hir::Crate>, def: Definition) | |||
335 | if func.is_async(db) { | 335 | if func.is_async(db) { |
336 | h |= HlMod::Async; | 336 | h |= HlMod::Async; |
337 | } | 337 | } |
338 | if func.krate(db) != krate { | 338 | if Some(func.module(db).krate()) != krate { |
339 | h |= HlMod::Foreign; | 339 | h |= HlMod::Foreign; |
340 | } | 340 | } |
341 | return h; | 341 | return h; |
@@ -348,7 +348,7 @@ fn highlight_def(db: &RootDatabase, krate: Option<hir::Crate>, def: Definition) | |||
348 | }; | 348 | }; |
349 | let mut h = Highlight::new(h); | 349 | let mut h = Highlight::new(h); |
350 | 350 | ||
351 | if Some(adt.krate(db)) != krate { | 351 | if Some(adt.module(db).krate()) != krate { |
352 | h |= HlMod::Foreign; | 352 | h |= HlMod::Foreign; |
353 | } | 353 | } |
354 | 354 | ||
@@ -357,7 +357,7 @@ fn highlight_def(db: &RootDatabase, krate: Option<hir::Crate>, def: Definition) | |||
357 | hir::ModuleDef::Variant(variant) => { | 357 | hir::ModuleDef::Variant(variant) => { |
358 | let mut h = Highlight::new(HlTag::Symbol(SymbolKind::Variant)); | 358 | let mut h = Highlight::new(HlTag::Symbol(SymbolKind::Variant)); |
359 | 359 | ||
360 | if Some(variant.krate(db)) != krate { | 360 | if Some(variant.module(db).krate()) != krate { |
361 | h |= HlMod::Foreign; | 361 | h |= HlMod::Foreign; |
362 | } | 362 | } |
363 | 363 | ||
@@ -380,7 +380,7 @@ fn highlight_def(db: &RootDatabase, krate: Option<hir::Crate>, def: Definition) | |||
380 | } | 380 | } |
381 | } | 381 | } |
382 | 382 | ||
383 | if konst.krate(db) != krate { | 383 | if Some(konst.module(db).krate()) != krate { |
384 | h |= HlMod::Foreign; | 384 | h |= HlMod::Foreign; |
385 | } | 385 | } |
386 | 386 | ||
@@ -393,7 +393,7 @@ fn highlight_def(db: &RootDatabase, krate: Option<hir::Crate>, def: Definition) | |||
393 | h |= HlMod::Unsafe; | 393 | h |= HlMod::Unsafe; |
394 | } | 394 | } |
395 | 395 | ||
396 | if Some(trait_.krate(db)) != krate { | 396 | if Some(trait_.module(db).krate()) != krate { |
397 | h |= HlMod::Foreign; | 397 | h |= HlMod::Foreign; |
398 | } | 398 | } |
399 | 399 | ||
@@ -416,7 +416,7 @@ fn highlight_def(db: &RootDatabase, krate: Option<hir::Crate>, def: Definition) | |||
416 | } | 416 | } |
417 | } | 417 | } |
418 | 418 | ||
419 | if Some(type_.krate(db)) != krate { | 419 | if Some(type_.module(db).krate()) != krate { |
420 | h |= HlMod::Foreign; | 420 | h |= HlMod::Foreign; |
421 | } | 421 | } |
422 | 422 | ||
@@ -431,7 +431,7 @@ fn highlight_def(db: &RootDatabase, krate: Option<hir::Crate>, def: Definition) | |||
431 | h |= HlMod::Unsafe; | 431 | h |= HlMod::Unsafe; |
432 | } | 432 | } |
433 | 433 | ||
434 | if s.krate(db) != krate { | 434 | if Some(s.module(db).krate()) != krate { |
435 | h |= HlMod::Foreign; | 435 | h |= HlMod::Foreign; |
436 | } | 436 | } |
437 | 437 | ||