remove relative_path_buf workaround
The upstream problem was fixed with the change to 1.0
This commit is contained in:
parent
da5528824a
commit
8464c45086
@ -134,10 +134,7 @@ fn resolve_relative_path(
|
|||||||
) -> Option<FileId> {
|
) -> Option<FileId> {
|
||||||
let path = {
|
let path = {
|
||||||
let mut path = self.0.file_relative_path(anchor);
|
let mut path = self.0.file_relative_path(anchor);
|
||||||
// Workaround for relative path API: turn `lib.rs` into ``.
|
assert!(path.pop());
|
||||||
if !path.pop() {
|
|
||||||
path = RelativePathBuf::default();
|
|
||||||
}
|
|
||||||
path.push(relative_path);
|
path.push(relative_path);
|
||||||
path.normalize()
|
path.normalize()
|
||||||
};
|
};
|
||||||
|
@ -30,10 +30,7 @@ pub(super) fn descend_into_definition(
|
|||||||
None => path.push(&name.to_string()),
|
None => path.push(&name.to_string()),
|
||||||
Some(attr_path) => {
|
Some(attr_path) => {
|
||||||
if self.root_non_dir_owner {
|
if self.root_non_dir_owner {
|
||||||
// Workaround for relative path API: turn `lib.rs` into ``.
|
assert!(path.pop());
|
||||||
if !path.pop() {
|
|
||||||
path = RelativePathBuf::default();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
path.push(attr_path);
|
path.push(attr_path);
|
||||||
}
|
}
|
||||||
@ -48,17 +45,13 @@ pub(super) fn resolve_declaration(
|
|||||||
name: &Name,
|
name: &Name,
|
||||||
attr_path: Option<&SmolStr>,
|
attr_path: Option<&SmolStr>,
|
||||||
) -> Result<(FileId, ModDir), RelativePathBuf> {
|
) -> Result<(FileId, ModDir), RelativePathBuf> {
|
||||||
let empty_path = RelativePathBuf::default();
|
|
||||||
let file_id = file_id.original_file(db);
|
let file_id = file_id.original_file(db);
|
||||||
|
|
||||||
let mut candidate_files = Vec::new();
|
let mut candidate_files = Vec::new();
|
||||||
match attr_to_path(attr_path) {
|
match attr_to_path(attr_path) {
|
||||||
Some(attr_path) => {
|
Some(attr_path) => {
|
||||||
let base = if self.root_non_dir_owner {
|
let base =
|
||||||
self.path.parent().unwrap_or(&empty_path)
|
if self.root_non_dir_owner { self.path.parent().unwrap() } else { &self.path };
|
||||||
} else {
|
|
||||||
&self.path
|
|
||||||
};
|
|
||||||
candidate_files.push(base.join(attr_path))
|
candidate_files.push(base.join(attr_path))
|
||||||
}
|
}
|
||||||
None => {
|
None => {
|
||||||
|
Loading…
Reference in New Issue
Block a user