mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-03 15:15:24 +00:00
Merge #7923
7923: Remove useless code_model indirection r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
This commit is contained in:
commit
c5189a22cc
8 changed files with 2131 additions and 2138 deletions
File diff suppressed because it is too large
Load diff
|
@ -11,9 +11,8 @@ use hir_def::{
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
code_model::{BuiltinType, GenericParam},
|
Adt, AssocItem, BuiltinType, DefWithBody, Field, GenericDef, GenericParam, Label, Local,
|
||||||
Adt, AssocItem, DefWithBody, Field, GenericDef, Label, Local, MacroDef, ModuleDef, Variant,
|
MacroDef, ModuleDef, Variant, VariantDef,
|
||||||
VariantDef,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
macro_rules! from_id {
|
macro_rules! from_id {
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -20,12 +20,11 @@ use syntax::{
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
code_model::Access,
|
|
||||||
db::HirDatabase,
|
db::HirDatabase,
|
||||||
semantics::source_to_def::{ChildContainer, SourceToDefCache, SourceToDefCtx},
|
semantics::source_to_def::{ChildContainer, SourceToDefCache, SourceToDefCtx},
|
||||||
source_analyzer::{resolve_hir_path, SourceAnalyzer},
|
source_analyzer::{resolve_hir_path, SourceAnalyzer},
|
||||||
AssocItem, Callable, ConstParam, Crate, Field, Function, HirFileId, Impl, InFile, Label,
|
Access, AssocItem, Callable, ConstParam, Crate, Field, Function, HirFileId, Impl, InFile,
|
||||||
LifetimeParam, Local, MacroDef, Module, ModuleDef, Name, Path, ScopeDef, Trait, Type,
|
Label, LifetimeParam, Local, MacroDef, Module, ModuleDef, Name, Path, ScopeDef, Trait, Type,
|
||||||
TypeAlias, TypeParam, VariantDef,
|
TypeAlias, TypeParam, VariantDef,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -28,9 +28,8 @@ use syntax::{
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
code_model::BuiltinType, db::HirDatabase, semantics::PathResolution, Adt, Const, Field,
|
db::HirDatabase, semantics::PathResolution, Adt, BuiltinType, Const, Field, Function, Local,
|
||||||
Function, Local, MacroDef, ModuleDef, Static, Struct, Trait, Type, TypeAlias, TypeParam,
|
MacroDef, ModuleDef, Static, Struct, Trait, Type, TypeAlias, TypeParam, Variant,
|
||||||
Variant,
|
|
||||||
};
|
};
|
||||||
use base_db::CrateId;
|
use base_db::CrateId;
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
use std::iter;
|
use std::iter;
|
||||||
|
|
||||||
use either::Either;
|
use either::Either;
|
||||||
use hir::{AsName, Module, ModuleDef, Name, Variant};
|
use hir::{Module, ModuleDef, Name, Variant};
|
||||||
use ide_db::{
|
use ide_db::{
|
||||||
defs::Definition,
|
defs::Definition,
|
||||||
helpers::{
|
helpers::{
|
||||||
|
@ -133,7 +133,7 @@ fn existing_definition(db: &RootDatabase, variant_name: &ast::Name, variant: &Va
|
||||||
),
|
),
|
||||||
_ => false,
|
_ => false,
|
||||||
})
|
})
|
||||||
.any(|(name, _)| name == variant_name.as_name())
|
.any(|(name, _)| name.to_string() == variant_name.to_string())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn insert_import(
|
fn insert_import(
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use std::iter;
|
use std::iter;
|
||||||
|
|
||||||
use hir::{AsAssocItem, AsName};
|
use hir::AsAssocItem;
|
||||||
use ide_db::helpers::{import_assets::ImportCandidate, mod_path_to_ast};
|
use ide_db::helpers::{import_assets::ImportCandidate, mod_path_to_ast};
|
||||||
use ide_db::RootDatabase;
|
use ide_db::RootDatabase;
|
||||||
use syntax::{
|
use syntax::{
|
||||||
|
@ -160,7 +160,9 @@ fn find_trait_method(
|
||||||
) -> Option<hir::Function> {
|
) -> Option<hir::Function> {
|
||||||
if let Some(hir::AssocItem::Function(method)) =
|
if let Some(hir::AssocItem::Function(method)) =
|
||||||
trait_.items(db).into_iter().find(|item: &hir::AssocItem| {
|
trait_.items(db).into_iter().find(|item: &hir::AssocItem| {
|
||||||
item.name(db).map(|name| name == trait_method_name.as_name()).unwrap_or(false)
|
item.name(db)
|
||||||
|
.map(|name| name.to_string() == trait_method_name.to_string())
|
||||||
|
.unwrap_or(false)
|
||||||
})
|
})
|
||||||
{
|
{
|
||||||
Some(method)
|
Some(method)
|
||||||
|
|
|
@ -46,7 +46,7 @@ This is *the* entry point, but it front-loads a lot of complexity, so its fine t
|
||||||
|
|
||||||
`crates/rust-analyzer/src/handlers.rs` implements all LSP requests and is a great place to start if you are already familiar with LSP.
|
`crates/rust-analyzer/src/handlers.rs` implements all LSP requests and is a great place to start if you are already familiar with LSP.
|
||||||
|
|
||||||
`Analysis` and `AnalysisHost` types define the main API.
|
`Analysis` and `AnalysisHost` types define the main API for consumers of IDE services.
|
||||||
|
|
||||||
## Code Map
|
## Code Map
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue