mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-29 05:15:04 +00:00
Fix typos in ARCHITECTURE.md and a number of crates
specifically: gen_lsp_server, ra_arena, ra_cli, ra_db, ra_hir
This commit is contained in:
parent
f8261d611a
commit
0b8fbb4fad
23 changed files with 150 additions and 91 deletions
|
@ -13,8 +13,8 @@ use crate::{
|
|||
ty::InferenceResult,
|
||||
};
|
||||
|
||||
/// hir::Crate describes a single crate. It's the main inteface with which
|
||||
/// crate's dependencies interact. Mostly, it should be just a proxy for the
|
||||
/// hir::Crate describes a single crate. It's the main interface with which
|
||||
/// a crate's dependencies interact. Mostly, it should be just a proxy for the
|
||||
/// root module.
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||
pub struct Crate {
|
||||
|
@ -78,6 +78,7 @@ impl Module {
|
|||
pub fn definition_source(&self, db: &impl HirDatabase) -> Cancelable<(FileId, ModuleSource)> {
|
||||
self.definition_source_impl(db)
|
||||
}
|
||||
|
||||
/// Returns a node which declares this module, either a `mod foo;` or a `mod foo {}`.
|
||||
/// `None` for the crate root.
|
||||
pub fn declaration_source(
|
||||
|
@ -91,20 +92,24 @@ impl Module {
|
|||
pub fn krate(&self, db: &impl HirDatabase) -> Cancelable<Option<Crate>> {
|
||||
self.krate_impl(db)
|
||||
}
|
||||
|
||||
/// Topmost parent of this module. Every module has a `crate_root`, but some
|
||||
/// might miss `krate`. This can happen if a module's file is not included
|
||||
/// into any module tree of any target from Cargo.toml.
|
||||
/// might be missing `krate`. This can happen if a module's file is not included
|
||||
/// in the module tree of any target in Cargo.toml.
|
||||
pub fn crate_root(&self, db: &impl HirDatabase) -> Cancelable<Module> {
|
||||
self.crate_root_impl(db)
|
||||
}
|
||||
|
||||
/// Finds a child module with the specified name.
|
||||
pub fn child(&self, db: &impl HirDatabase, name: &Name) -> Cancelable<Option<Module>> {
|
||||
self.child_impl(db, name)
|
||||
}
|
||||
|
||||
/// Finds a parent module.
|
||||
pub fn parent(&self, db: &impl HirDatabase) -> Cancelable<Option<Module>> {
|
||||
self.parent_impl(db)
|
||||
}
|
||||
|
||||
pub fn path_to_root(&self, db: &impl HirDatabase) -> Cancelable<Vec<Module>> {
|
||||
let mut res = vec![self.clone()];
|
||||
let mut curr = self.clone();
|
||||
|
@ -114,13 +119,16 @@ impl Module {
|
|||
}
|
||||
Ok(res)
|
||||
}
|
||||
|
||||
/// Returns a `ModuleScope`: a set of items, visible in this module.
|
||||
pub fn scope(&self, db: &impl HirDatabase) -> Cancelable<ModuleScope> {
|
||||
self.scope_impl(db)
|
||||
}
|
||||
|
||||
pub fn resolve_path(&self, db: &impl HirDatabase, path: &Path) -> Cancelable<PerNs<DefId>> {
|
||||
self.resolve_path_impl(db, path)
|
||||
}
|
||||
|
||||
pub fn problems(
|
||||
&self,
|
||||
db: &impl HirDatabase,
|
||||
|
@ -140,6 +148,7 @@ impl StructField {
|
|||
pub fn name(&self) -> &Name {
|
||||
&self.name
|
||||
}
|
||||
|
||||
pub fn type_ref(&self) -> &TypeRef {
|
||||
&self.type_ref
|
||||
}
|
||||
|
@ -160,18 +169,21 @@ impl VariantData {
|
|||
_ => &[],
|
||||
}
|
||||
}
|
||||
|
||||
pub fn is_struct(&self) -> bool {
|
||||
match self {
|
||||
VariantData::Struct(..) => true,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn is_tuple(&self) -> bool {
|
||||
match self {
|
||||
VariantData::Tuple(..) => true,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn is_unit(&self) -> bool {
|
||||
match self {
|
||||
VariantData::Unit => true,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue