mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 12:54:58 +00:00
Renames, comments, and dead code removal
This commit is contained in:
parent
7bbca7a1b3
commit
5452368fad
4 changed files with 8 additions and 23 deletions
|
@ -43,8 +43,8 @@ use tt::{Ident, Leaf, Literal, TokenTree};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
db::{DefDatabase, HirDatabase},
|
db::{DefDatabase, HirDatabase},
|
||||||
|
doc_links::Resolvable,
|
||||||
has_source::HasSource,
|
has_source::HasSource,
|
||||||
link_rewrite::Resolvable,
|
|
||||||
HirDisplay, InFile, Name,
|
HirDisplay, InFile, Name,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -234,23 +234,6 @@ impl ModuleDef {
|
||||||
ModuleDef::BuiltinType(it) => Some(it.as_name()),
|
ModuleDef::BuiltinType(it) => Some(it.as_name()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn resolver<D: DefDatabase + HirDatabase>(&self, db: &D) -> Option<Resolver> {
|
|
||||||
Some(match self {
|
|
||||||
ModuleDef::Module(m) => ModuleId::from(m.clone()).resolver(db),
|
|
||||||
ModuleDef::Function(f) => FunctionId::from(f.clone()).resolver(db),
|
|
||||||
ModuleDef::Adt(adt) => AdtId::from(adt.clone()).resolver(db),
|
|
||||||
ModuleDef::EnumVariant(ev) => {
|
|
||||||
GenericDefId::from(GenericDef::from(ev.clone())).resolver(db)
|
|
||||||
}
|
|
||||||
ModuleDef::Const(c) => GenericDefId::from(GenericDef::from(c.clone())).resolver(db),
|
|
||||||
ModuleDef::Static(s) => StaticId::from(s.clone()).resolver(db),
|
|
||||||
ModuleDef::Trait(t) => TraitId::from(t.clone()).resolver(db),
|
|
||||||
ModuleDef::TypeAlias(t) => ModuleId::from(t.module(db)).resolver(db),
|
|
||||||
// FIXME: This should be a resolver relative to `std/core`
|
|
||||||
ModuleDef::BuiltinType(_t) => None?,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub use hir_def::{
|
pub use hir_def::{
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
//! Resolves and rewrites links in markdown documentation for hovers/completion windows.
|
//! Resolves links in markdown documentation.
|
||||||
|
|
||||||
use std::iter::once;
|
use std::iter::once;
|
||||||
|
|
||||||
|
@ -113,7 +113,7 @@ fn try_resolve_path(db: &dyn HirDatabase, moddef: &ModuleDef, link_target: &str)
|
||||||
.map(|url| url.into_string())
|
.map(|url| url.into_string())
|
||||||
}
|
}
|
||||||
|
|
||||||
// Strip prefixes, suffixes, and inline code marks from the given string.
|
/// Strip prefixes, suffixes, and inline code marks from the given string.
|
||||||
fn strip_prefixes_suffixes(mut s: &str) -> &str {
|
fn strip_prefixes_suffixes(mut s: &str) -> &str {
|
||||||
s = s.trim_matches('`');
|
s = s.trim_matches('`');
|
||||||
|
|
|
@ -27,7 +27,7 @@ pub mod diagnostics;
|
||||||
|
|
||||||
mod from_id;
|
mod from_id;
|
||||||
mod code_model;
|
mod code_model;
|
||||||
mod link_rewrite;
|
mod doc_links;
|
||||||
|
|
||||||
mod has_source;
|
mod has_source;
|
||||||
|
|
||||||
|
@ -38,8 +38,8 @@ pub use crate::{
|
||||||
Function, GenericDef, HasAttrs, HasVisibility, ImplDef, Local, MacroDef, Module, ModuleDef,
|
Function, GenericDef, HasAttrs, HasVisibility, ImplDef, Local, MacroDef, Module, ModuleDef,
|
||||||
ScopeDef, Static, Struct, Trait, Type, TypeAlias, TypeParam, Union, VariantDef, Visibility,
|
ScopeDef, Static, Struct, Trait, Type, TypeAlias, TypeParam, Union, VariantDef, Visibility,
|
||||||
},
|
},
|
||||||
|
doc_links::resolve_doc_link,
|
||||||
has_source::HasSource,
|
has_source::HasSource,
|
||||||
link_rewrite::resolve_doc_link,
|
|
||||||
semantics::{original_range, PathResolution, Semantics, SemanticsScope},
|
semantics::{original_range, PathResolution, Semantics, SemanticsScope},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
//! This is a wrapper around [`hir::link_rewrite`] connecting it to the markdown parser.
|
//! Resolves and rewrites links in markdown documentation.
|
||||||
|
//!
|
||||||
|
//! Most of the implementation can be found in [`hir::doc_links`].
|
||||||
|
|
||||||
use pulldown_cmark::{CowStr, Event, Options, Parser, Tag};
|
use pulldown_cmark::{CowStr, Event, Options, Parser, Tag};
|
||||||
use pulldown_cmark_to_cmark::{cmark_with_options, Options as CmarkOptions};
|
use pulldown_cmark_to_cmark::{cmark_with_options, Options as CmarkOptions};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue