mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-26 04:53:34 +00:00
remove some crates.io deps
This commit is contained in:
parent
1fa842c8c9
commit
4c745d219f
3 changed files with 31 additions and 102 deletions
85
Cargo.lock
generated
85
Cargo.lock
generated
|
@ -408,17 +408,6 @@ dependencies = [
|
||||||
"unicode-width",
|
"unicode-width",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "getrandom"
|
|
||||||
version = "0.1.14"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "7abc8dd8451921606d809ba32e95b6111925cd2906060d2dcc29c070220503eb"
|
|
||||||
dependencies = [
|
|
||||||
"cfg-if",
|
|
||||||
"libc",
|
|
||||||
"wasi",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "gimli"
|
name = "gimli"
|
||||||
version = "0.22.0"
|
version = "0.22.0"
|
||||||
|
@ -639,12 +628,6 @@ dependencies = [
|
||||||
"url",
|
"url",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "maplit"
|
|
||||||
version = "1.0.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "3e2e65a1a2e43cfcb47a895c4c8b10d1f4a61097f9f254f183aee60cad9c651d"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "matchers"
|
name = "matchers"
|
||||||
version = "0.0.1"
|
version = "0.0.1"
|
||||||
|
@ -907,12 +890,6 @@ version = "0.2.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b4596b6d070b27117e987119b4dac604f3c58cfb0b191112e24771b2faeac1a6"
|
checksum = "b4596b6d070b27117e987119b4dac604f3c58cfb0b191112e24771b2faeac1a6"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "ppv-lite86"
|
|
||||||
version = "0.2.8"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "237a5ed80e274dbc66f86bd59c1e25edc039660be53194b5fe0a482e0f2612ea"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "proc-macro2"
|
name = "proc-macro2"
|
||||||
version = "1.0.19"
|
version = "1.0.19"
|
||||||
|
@ -1105,9 +1082,8 @@ dependencies = [
|
||||||
"expect",
|
"expect",
|
||||||
"indexmap",
|
"indexmap",
|
||||||
"itertools",
|
"itertools",
|
||||||
"lazy_static",
|
|
||||||
"log",
|
"log",
|
||||||
"maplit",
|
"once_cell",
|
||||||
"oorandom",
|
"oorandom",
|
||||||
"pulldown-cmark",
|
"pulldown-cmark",
|
||||||
"pulldown-cmark-to-cmark",
|
"pulldown-cmark-to-cmark",
|
||||||
|
@ -1124,11 +1100,9 @@ dependencies = [
|
||||||
"ra_syntax",
|
"ra_syntax",
|
||||||
"ra_text_edit",
|
"ra_text_edit",
|
||||||
"ra_tt",
|
"ra_tt",
|
||||||
"rand",
|
|
||||||
"rustc-hash",
|
"rustc-hash",
|
||||||
"stdx",
|
"stdx",
|
||||||
"test_utils",
|
"test_utils",
|
||||||
"url",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -1288,57 +1262,6 @@ dependencies = [
|
||||||
"stdx",
|
"stdx",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "rand"
|
|
||||||
version = "0.7.3"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03"
|
|
||||||
dependencies = [
|
|
||||||
"getrandom",
|
|
||||||
"libc",
|
|
||||||
"rand_chacha",
|
|
||||||
"rand_core",
|
|
||||||
"rand_hc",
|
|
||||||
"rand_pcg",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "rand_chacha"
|
|
||||||
version = "0.2.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402"
|
|
||||||
dependencies = [
|
|
||||||
"ppv-lite86",
|
|
||||||
"rand_core",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "rand_core"
|
|
||||||
version = "0.5.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19"
|
|
||||||
dependencies = [
|
|
||||||
"getrandom",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "rand_hc"
|
|
||||||
version = "0.2.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c"
|
|
||||||
dependencies = [
|
|
||||||
"rand_core",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "rand_pcg"
|
|
||||||
version = "0.2.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "16abd0c1b639e9eb4d7c50c0b8100b0d0f849be2349829c740fe8e6eb4816429"
|
|
||||||
dependencies = [
|
|
||||||
"rand_core",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rayon"
|
name = "rayon"
|
||||||
version = "1.3.1"
|
version = "1.3.1"
|
||||||
|
@ -1923,12 +1846,6 @@ dependencies = [
|
||||||
"winapi-util",
|
"winapi-util",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "wasi"
|
|
||||||
version = "0.9.0+wasi-snapshot-preview1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "winapi"
|
name = "winapi"
|
||||||
version = "0.2.8"
|
version = "0.2.8"
|
||||||
|
|
|
@ -17,13 +17,11 @@ indexmap = "1.3.2"
|
||||||
itertools = "0.9.0"
|
itertools = "0.9.0"
|
||||||
log = "0.4.8"
|
log = "0.4.8"
|
||||||
rustc-hash = "1.1.0"
|
rustc-hash = "1.1.0"
|
||||||
rand = { version = "0.7.3", features = ["small_rng"] }
|
|
||||||
url = "*"
|
url = "*"
|
||||||
maplit = "*"
|
|
||||||
lazy_static = "*"
|
|
||||||
pulldown-cmark-to-cmark = "4.0.2"
|
pulldown-cmark-to-cmark = "4.0.2"
|
||||||
pulldown-cmark = "0.7.0"
|
pulldown-cmark = "0.7.0"
|
||||||
oorandom = "11.1.2"
|
oorandom = "11.1.2"
|
||||||
|
once_cell = "1"
|
||||||
|
|
||||||
stdx = { path = "../stdx" }
|
stdx = { path = "../stdx" }
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
use std::collections::{HashMap, HashSet};
|
use std::collections::{HashMap, HashSet};
|
||||||
use std::iter::once;
|
use std::{
|
||||||
|
iter::{once, FromIterator},
|
||||||
|
sync::Mutex,
|
||||||
|
};
|
||||||
|
|
||||||
use hir::{
|
use hir::{
|
||||||
db::DefDatabase, Adt, AsAssocItem, AsName, AssocItemContainer, AttrDef, Crate, Documentation,
|
db::DefDatabase, Adt, AsAssocItem, AsName, AssocItemContainer, AttrDef, Crate, Documentation,
|
||||||
|
@ -7,8 +10,7 @@ use hir::{
|
||||||
ModuleSource, Semantics,
|
ModuleSource, Semantics,
|
||||||
};
|
};
|
||||||
use itertools::Itertools;
|
use itertools::Itertools;
|
||||||
use lazy_static::lazy_static;
|
use once_cell::sync::Lazy;
|
||||||
use maplit::{hashmap, hashset};
|
|
||||||
use pulldown_cmark::{CowStr, Event, Options, Parser, Tag};
|
use pulldown_cmark::{CowStr, Event, Options, Parser, Tag};
|
||||||
use pulldown_cmark_to_cmark::cmark;
|
use pulldown_cmark_to_cmark::cmark;
|
||||||
use ra_db::SourceDatabase;
|
use ra_db::SourceDatabase;
|
||||||
|
@ -419,14 +421,26 @@ enum Namespace {
|
||||||
Macros,
|
Macros,
|
||||||
}
|
}
|
||||||
|
|
||||||
lazy_static!(
|
static NS_MAP: Lazy<
|
||||||
/// Map of namespaces to identifying prefixes and suffixes as defined by RFC1946.
|
HashMap<Namespace, (HashSet<&'static &'static str>, HashSet<&'static &'static str>)>,
|
||||||
static ref NS_MAP: HashMap<Namespace, (HashSet<&'static str>, HashSet<&'static str>)> = hashmap!{
|
> = Lazy::new(|| {
|
||||||
Namespace::Types => (hashset!{"type", "struct", "enum", "mod", "trait", "union", "module"}, hashset!{}),
|
let mut map = HashMap::new();
|
||||||
Namespace::Values => (hashset!{"value", "function", "fn", "method", "const", "static", "mod", "module"}, hashset!{"()"}),
|
map.insert(Namespace::Types, (HashSet::new(), HashSet::new()));
|
||||||
Namespace::Macros => (hashset!{"macro"}, hashset!{"!"})
|
map.insert(
|
||||||
};
|
Namespace::Values,
|
||||||
);
|
(
|
||||||
|
HashSet::from_iter(
|
||||||
|
["value", "function", "fn", "method", "const", "static", "mod", "module"].iter(),
|
||||||
|
),
|
||||||
|
HashSet::from_iter(["()"].iter()),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
map.insert(
|
||||||
|
Namespace::Macros,
|
||||||
|
(HashSet::from_iter(["macro"].iter()), HashSet::from_iter(["!"].iter())),
|
||||||
|
);
|
||||||
|
map
|
||||||
|
});
|
||||||
|
|
||||||
impl Namespace {
|
impl Namespace {
|
||||||
/// Extract the specified namespace from an intra-doc-link if one exists.
|
/// Extract the specified namespace from an intra-doc-link if one exists.
|
||||||
|
@ -437,7 +451,7 @@ impl Namespace {
|
||||||
prefixes
|
prefixes
|
||||||
.iter()
|
.iter()
|
||||||
.map(|prefix| {
|
.map(|prefix| {
|
||||||
s.starts_with(prefix)
|
s.starts_with(*prefix)
|
||||||
&& s.chars()
|
&& s.chars()
|
||||||
.nth(prefix.len() + 1)
|
.nth(prefix.len() + 1)
|
||||||
.map(|c| c == '@' || c == ' ')
|
.map(|c| c == '@' || c == ' ')
|
||||||
|
@ -447,7 +461,7 @@ impl Namespace {
|
||||||
|| suffixes
|
|| suffixes
|
||||||
.iter()
|
.iter()
|
||||||
.map(|suffix| {
|
.map(|suffix| {
|
||||||
s.starts_with(suffix)
|
s.starts_with(*suffix)
|
||||||
&& s.chars()
|
&& s.chars()
|
||||||
.nth(suffix.len() + 1)
|
.nth(suffix.len() + 1)
|
||||||
.map(|c| c == '@' || c == ' ')
|
.map(|c| c == '@' || c == ' ')
|
||||||
|
@ -464,8 +478,8 @@ impl Namespace {
|
||||||
fn strip_prefixes_suffixes(mut s: &str) -> &str {
|
fn strip_prefixes_suffixes(mut s: &str) -> &str {
|
||||||
s = s.trim_matches('`');
|
s = s.trim_matches('`');
|
||||||
NS_MAP.iter().for_each(|(_, (prefixes, suffixes))| {
|
NS_MAP.iter().for_each(|(_, (prefixes, suffixes))| {
|
||||||
prefixes.iter().for_each(|prefix| s = s.trim_start_matches(prefix));
|
prefixes.iter().for_each(|prefix| s = s.trim_start_matches(*prefix));
|
||||||
suffixes.iter().for_each(|suffix| s = s.trim_end_matches(suffix));
|
suffixes.iter().for_each(|suffix| s = s.trim_end_matches(*suffix));
|
||||||
});
|
});
|
||||||
s.trim_start_matches("@").trim()
|
s.trim_start_matches("@").trim()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue