mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-13 05:38:46 +00:00
cleanup
This commit is contained in:
parent
99b6ecfab0
commit
bca708ba4c
4 changed files with 16 additions and 24 deletions
|
@ -36,12 +36,6 @@ impl Module {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// impl HirFileId {
|
|
||||||
// pub fn debug(self, db: &impl HirDebugDatabase) -> impl fmt::Debug + '_ {
|
|
||||||
// debug_fn(move |fmt| db.debug_hir_file_id(self, fmt))
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
pub trait HirDebugHelper: HirDatabase {
|
pub trait HirDebugHelper: HirDatabase {
|
||||||
fn crate_name(&self, _krate: CrateId) -> Option<String> {
|
fn crate_name(&self, _krate: CrateId) -> Option<String> {
|
||||||
None
|
None
|
||||||
|
|
|
@ -59,12 +59,13 @@ pub mod from_source;
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod marks;
|
mod marks;
|
||||||
|
|
||||||
use hir_expand::{ast_id_map::FileAstId, AstId};
|
use hir_expand::{
|
||||||
|
ast_id_map::{AstIdMap, FileAstId},
|
||||||
|
AstId,
|
||||||
|
};
|
||||||
|
|
||||||
use crate::{ids::MacroFileKind, name::AsName, resolve::Resolver};
|
use crate::{ids::MacroFileKind, name::AsName, resolve::Resolver};
|
||||||
|
|
||||||
use hir_expand::ast_id_map::AstIdMap;
|
|
||||||
|
|
||||||
pub use crate::{
|
pub use crate::{
|
||||||
adt::VariantDef,
|
adt::VariantDef,
|
||||||
either::Either,
|
either::Either,
|
||||||
|
|
|
@ -14,19 +14,6 @@ use ra_syntax::ast::{self, AstNode};
|
||||||
|
|
||||||
use crate::{ast_id_map::FileAstId, db::AstDatabase};
|
use crate::{ast_id_map::FileAstId, db::AstDatabase};
|
||||||
|
|
||||||
macro_rules! impl_intern_key {
|
|
||||||
($name:ident) => {
|
|
||||||
impl salsa::InternKey for $name {
|
|
||||||
fn from_intern_id(v: salsa::InternId) -> Self {
|
|
||||||
$name(v)
|
|
||||||
}
|
|
||||||
fn as_intern_id(&self) -> salsa::InternId {
|
|
||||||
self.0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Input to the analyzer is a set of files, where each file is identified by
|
/// Input to the analyzer is a set of files, where each file is identified by
|
||||||
/// `FileId` and contains source code. However, another source of source code in
|
/// `FileId` and contains source code. However, another source of source code in
|
||||||
/// Rust are macros: each macro can be thought of as producing a "temporary
|
/// Rust are macros: each macro can be thought of as producing a "temporary
|
||||||
|
@ -101,7 +88,14 @@ pub enum MacroFileKind {
|
||||||
/// `println!("Hello, {}", world)`.
|
/// `println!("Hello, {}", world)`.
|
||||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
||||||
pub struct MacroCallId(salsa::InternId);
|
pub struct MacroCallId(salsa::InternId);
|
||||||
impl_intern_key!(MacroCallId);
|
impl salsa::InternKey for MacroCallId {
|
||||||
|
fn from_intern_id(v: salsa::InternId) -> Self {
|
||||||
|
MacroCallId(v)
|
||||||
|
}
|
||||||
|
fn as_intern_id(&self) -> salsa::InternId {
|
||||||
|
self.0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
||||||
pub struct MacroDefId {
|
pub struct MacroDefId {
|
||||||
|
|
|
@ -27,10 +27,13 @@ ra_db = { path = "../ra_db" }
|
||||||
ra_cfg = { path = "../ra_cfg" }
|
ra_cfg = { path = "../ra_cfg" }
|
||||||
ra_fmt = { path = "../ra_fmt" }
|
ra_fmt = { path = "../ra_fmt" }
|
||||||
ra_prof = { path = "../ra_prof" }
|
ra_prof = { path = "../ra_prof" }
|
||||||
hir = { path = "../ra_hir", package = "ra_hir" }
|
|
||||||
test_utils = { path = "../test_utils" }
|
test_utils = { path = "../test_utils" }
|
||||||
ra_assists = { path = "../ra_assists" }
|
ra_assists = { path = "../ra_assists" }
|
||||||
|
|
||||||
|
# ra_ide_api should depend only on the top-level `hir` package. if you need
|
||||||
|
# something from some `hir_xxx` subpackage, reexport the API via `hir`.
|
||||||
|
hir = { path = "../ra_hir", package = "ra_hir" }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
insta = "0.12.0"
|
insta = "0.12.0"
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue