mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-27 20:35:09 +00:00
remove more imports
This commit is contained in:
parent
79596abcaf
commit
6a755ed83a
2 changed files with 2 additions and 23 deletions
|
@ -4,7 +4,7 @@ use std::{
|
||||||
};
|
};
|
||||||
|
|
||||||
use im;
|
use im;
|
||||||
use ra_analysis::{FileId, FileResolver};
|
use ra_analysis::{FileId};
|
||||||
use relative_path::RelativePath;
|
use relative_path::RelativePath;
|
||||||
|
|
||||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||||
|
@ -64,27 +64,6 @@ impl PathMap {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl FileResolver for PathMap {
|
|
||||||
fn file_stem(&self, file_id: FileId) -> String {
|
|
||||||
self.get_path(file_id)
|
|
||||||
.file_stem()
|
|
||||||
.unwrap()
|
|
||||||
.to_str()
|
|
||||||
.unwrap()
|
|
||||||
.to_string()
|
|
||||||
}
|
|
||||||
|
|
||||||
fn resolve(&self, file_id: FileId, path: &RelativePath) -> Option<FileId> {
|
|
||||||
let path = path.to_path(&self.get_path(file_id));
|
|
||||||
let path = normalize(&path);
|
|
||||||
self.get_id(&path)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn debug_path(&self, file_id: FileId) -> Option<PathBuf> {
|
|
||||||
Some(self.get_path(file_id).to_owned())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn normalize(path: &Path) -> PathBuf {
|
fn normalize(path: &Path) -> PathBuf {
|
||||||
let mut components = path.components().peekable();
|
let mut components = path.components().peekable();
|
||||||
let mut ret = if let Some(c @ Component::Prefix(..)) = components.peek().cloned() {
|
let mut ret = if let Some(c @ Component::Prefix(..)) = components.peek().cloned() {
|
||||||
|
|
|
@ -6,7 +6,7 @@ use std::{
|
||||||
|
|
||||||
use languageserver_types::Url;
|
use languageserver_types::Url;
|
||||||
use ra_analysis::{
|
use ra_analysis::{
|
||||||
Analysis, AnalysisChange, AnalysisHost, CrateGraph, FileId, FileResolver, LibraryData,
|
Analysis, AnalysisChange, AnalysisHost, CrateGraph, FileId, LibraryData,
|
||||||
};
|
};
|
||||||
use rustc_hash::FxHashMap;
|
use rustc_hash::FxHashMap;
|
||||||
use failure::{bail, format_err};
|
use failure::{bail, format_err};
|
||||||
|
|
Loading…
Reference in a new issue