Skip to content

Commit 5452368

Browse files
committed
Renames, comments, and dead code removal
1 parent 7bbca7a commit 5452368

File tree

4 files changed

+8
-23
lines changed

4 files changed

+8
-23
lines changed

crates/hir/src/code_model.rs

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ use tt::{Ident, Leaf, Literal, TokenTree};
4343

4444
use crate::{
4545
db::{DefDatabase, HirDatabase},
46+
doc_links::Resolvable,
4647
has_source::HasSource,
47-
link_rewrite::Resolvable,
4848
HirDisplay, InFile, Name,
4949
};
5050

@@ -234,23 +234,6 @@ impl ModuleDef {
234234
ModuleDef::BuiltinType(it) => Some(it.as_name()),
235235
}
236236
}
237-
238-
pub fn resolver<D: DefDatabase + HirDatabase>(&self, db: &D) -> Option<Resolver> {
239-
Some(match self {
240-
ModuleDef::Module(m) => ModuleId::from(m.clone()).resolver(db),
241-
ModuleDef::Function(f) => FunctionId::from(f.clone()).resolver(db),
242-
ModuleDef::Adt(adt) => AdtId::from(adt.clone()).resolver(db),
243-
ModuleDef::EnumVariant(ev) => {
244-
GenericDefId::from(GenericDef::from(ev.clone())).resolver(db)
245-
}
246-
ModuleDef::Const(c) => GenericDefId::from(GenericDef::from(c.clone())).resolver(db),
247-
ModuleDef::Static(s) => StaticId::from(s.clone()).resolver(db),
248-
ModuleDef::Trait(t) => TraitId::from(t.clone()).resolver(db),
249-
ModuleDef::TypeAlias(t) => ModuleId::from(t.module(db)).resolver(db),
250-
// FIXME: This should be a resolver relative to `std/core`
251-
ModuleDef::BuiltinType(_t) => None?,
252-
})
253-
}
254237
}
255238

256239
pub use hir_def::{

crates/hir/src/link_rewrite.rs renamed to crates/hir/src/doc_links.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//! Resolves and rewrites links in markdown documentation for hovers/completion windows.
1+
//! Resolves links in markdown documentation.
22
33
use std::iter::once;
44

@@ -113,7 +113,7 @@ fn try_resolve_path(db: &dyn HirDatabase, moddef: &ModuleDef, link_target: &str)
113113
.map(|url| url.into_string())
114114
}
115115

116-
// Strip prefixes, suffixes, and inline code marks from the given string.
116+
/// Strip prefixes, suffixes, and inline code marks from the given string.
117117
fn strip_prefixes_suffixes(mut s: &str) -> &str {
118118
s = s.trim_matches('`');
119119

crates/hir/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ pub mod diagnostics;
2727

2828
mod from_id;
2929
mod code_model;
30-
mod link_rewrite;
30+
mod doc_links;
3131

3232
mod has_source;
3333

@@ -38,8 +38,8 @@ pub use crate::{
3838
Function, GenericDef, HasAttrs, HasVisibility, ImplDef, Local, MacroDef, Module, ModuleDef,
3939
ScopeDef, Static, Struct, Trait, Type, TypeAlias, TypeParam, Union, VariantDef, Visibility,
4040
},
41+
doc_links::resolve_doc_link,
4142
has_source::HasSource,
42-
link_rewrite::resolve_doc_link,
4343
semantics::{original_range, PathResolution, Semantics, SemanticsScope},
4444
};
4545

crates/ide/src/link_rewrite.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
//! This is a wrapper around [`hir::link_rewrite`] connecting it to the markdown parser.
1+
//! Resolves and rewrites links in markdown documentation.
2+
//!
3+
//! Most of the implementation can be found in [`hir::doc_links`].
24
35
use pulldown_cmark::{CowStr, Event, Options, Parser, Tag};
46
use pulldown_cmark_to_cmark::{cmark_with_options, Options as CmarkOptions};

0 commit comments

Comments
 (0)