mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-26 13:03:31 +00:00
Remove SmolStr from project model
This commit is contained in:
parent
ddbf43b630
commit
12c70871cc
5 changed files with 7 additions and 19 deletions
1
Cargo.lock
generated
1
Cargo.lock
generated
|
@ -1057,7 +1057,6 @@ dependencies = [
|
|||
"ra_db 0.1.0",
|
||||
"ra_vfs 0.1.0",
|
||||
"rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"smol_str 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"test_utils 0.1.0",
|
||||
"walkdir 2.2.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
|
|
@ -5,21 +5,13 @@ version = "0.1.0"
|
|||
authors = ["Aleksey Kladov <aleksey.kladov@gmail.com>"]
|
||||
|
||||
[dependencies]
|
||||
# itertools = "0.8.0"
|
||||
# join_to_string = "0.1.3"
|
||||
log = "0.4.5"
|
||||
# relative-path = "0.4.0"
|
||||
# rayon = "1.0.2"
|
||||
# fst = "0.3.1"
|
||||
rustc-hash = "1.0"
|
||||
# parking_lot = "0.7.0"
|
||||
# unicase = "2.2.0"
|
||||
|
||||
# TODO get rid of these?
|
||||
failure = "0.1.4"
|
||||
failure_derive = "0.1.4"
|
||||
|
||||
smol_str = { version = "0.1.9", features = ["serde"] }
|
||||
walkdir = "2.2.7"
|
||||
|
||||
cargo_metadata = "0.7.0"
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
use std::path::{Path, PathBuf};
|
||||
|
||||
use cargo_metadata::{MetadataCommand, CargoOpt};
|
||||
use smol_str::SmolStr;
|
||||
use ra_arena::{Arena, RawId, impl_arena_id};
|
||||
use rustc_hash::FxHashMap;
|
||||
use failure::format_err;
|
||||
|
@ -31,7 +30,7 @@ impl_arena_id!(Target);
|
|||
|
||||
#[derive(Debug, Clone)]
|
||||
struct PackageData {
|
||||
name: SmolStr,
|
||||
name: String,
|
||||
manifest: PathBuf,
|
||||
targets: Vec<Target>,
|
||||
is_member: bool,
|
||||
|
@ -41,13 +40,13 @@ struct PackageData {
|
|||
#[derive(Debug, Clone)]
|
||||
pub struct PackageDependency {
|
||||
pub pkg: Package,
|
||||
pub name: SmolStr,
|
||||
pub name: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
struct TargetData {
|
||||
pkg: Package,
|
||||
name: SmolStr,
|
||||
name: String,
|
||||
root: PathBuf,
|
||||
kind: TargetKind,
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ impl ProjectWorkspace {
|
|||
if let (Some(&from), Some(&to)) =
|
||||
(sysroot_crates.get(&from), sysroot_crates.get(&to))
|
||||
{
|
||||
if let Err(_) = crate_graph.add_dep(from, name.clone(), to) {
|
||||
if let Err(_) = crate_graph.add_dep(from, name.into(), to) {
|
||||
log::error!("cyclic dependency between sysroot crates")
|
||||
}
|
||||
}
|
||||
|
@ -101,7 +101,7 @@ impl ProjectWorkspace {
|
|||
for dep in pkg.dependencies(&self.cargo) {
|
||||
if let Some(&to) = pkg_to_lib_crate.get(&dep.pkg) {
|
||||
for &from in pkg_crates.get(&pkg).into_iter().flatten() {
|
||||
if let Err(_) = crate_graph.add_dep(from, dep.name.clone(), to) {
|
||||
if let Err(_) = crate_graph.add_dep(from, dep.name.clone().into(), to) {
|
||||
log::error!(
|
||||
"cyclic dependency {} -> {}",
|
||||
pkg.name(&self.cargo),
|
||||
|
|
|
@ -3,8 +3,6 @@ use std::{
|
|||
process::Command,
|
||||
};
|
||||
|
||||
use smol_str::SmolStr;
|
||||
|
||||
use ra_arena::{Arena, RawId, impl_arena_id};
|
||||
|
||||
use crate::Result;
|
||||
|
@ -20,7 +18,7 @@ impl_arena_id!(SysrootCrate);
|
|||
|
||||
#[derive(Debug, Clone)]
|
||||
struct SysrootCrateData {
|
||||
name: SmolStr,
|
||||
name: String,
|
||||
root: PathBuf,
|
||||
deps: Vec<SysrootCrate>,
|
||||
}
|
||||
|
@ -81,7 +79,7 @@ impl Sysroot {
|
|||
}
|
||||
|
||||
impl SysrootCrate {
|
||||
pub fn name(self, sysroot: &Sysroot) -> &SmolStr {
|
||||
pub fn name(self, sysroot: &Sysroot) -> &str {
|
||||
&sysroot.crates[self].name
|
||||
}
|
||||
pub fn root(self, sysroot: &Sysroot) -> &Path {
|
||||
|
|
Loading…
Reference in a new issue