Unnamed repository; edit this file 'description' to name the repository.
-rw-r--r--crates/load-cargo/src/lib.rs12
-rw-r--r--crates/proc-macro-api/src/bidirectional_protocol/msg.rs8
-rw-r--r--crates/proc-macro-srv-cli/src/main_loop.rs8
3 files changed, 14 insertions, 14 deletions
diff --git a/crates/load-cargo/src/lib.rs b/crates/load-cargo/src/lib.rs
index 4ffc8383b6..e01ce0b129 100644
--- a/crates/load-cargo/src/lib.rs
+++ b/crates/load-cargo/src/lib.rs
@@ -540,7 +540,7 @@ impl ProcMacroExpander for Expander {
current_dir: String,
) -> Result<tt::TopSubtree, ProcMacroExpansionError> {
let mut cb = |req| match req {
- SubRequest::LocalFileName { file_id } => {
+ SubRequest::LocalFilePath { file_id } => {
let file = FileId::from_raw(file_id);
let source_root_id = db.file_source_root(file).source_root_id(db);
let source_root = db.source_root(source_root_id).source_root(db);
@@ -548,9 +548,9 @@ impl ProcMacroExpander for Expander {
let name = source_root
.path_for_file(&file)
.and_then(|path| path.as_path())
- .and_then(|path| path.file_name().map(|filename| filename.to_owned()));
+ .map(|path| path.to_string());
- Ok(SubResponse::LocalFileNameResult { name })
+ Ok(SubResponse::LocalFilePathResult { name })
}
SubRequest::SourceText { file_id, start, end } => {
let file = FileId::from_raw(file_id);
@@ -558,7 +558,7 @@ impl ProcMacroExpander for Expander {
let slice = text.get(start as usize..end as usize).map(ToOwned::to_owned);
Ok(SubResponse::SourceTextResult { text: slice })
}
- SubRequest::FileName { file_id } => {
+ SubRequest::FilePath { file_id } => {
let file = FileId::from_raw(file_id);
let source_root_id = db.file_source_root(file).source_root_id(db);
let source_root = db.source_root(source_root_id).source_root(db);
@@ -566,10 +566,10 @@ impl ProcMacroExpander for Expander {
let name = source_root
.path_for_file(&file)
.and_then(|path| path.as_path())
- .and_then(|path| path.file_name().map(|filename| filename.to_owned()))
+ .map(|path| path.to_string())
.unwrap_or_default();
- Ok(SubResponse::FileNameResult { name })
+ Ok(SubResponse::FilePathResult { name })
}
};
match self.0.expand(
diff --git a/crates/proc-macro-api/src/bidirectional_protocol/msg.rs b/crates/proc-macro-api/src/bidirectional_protocol/msg.rs
index 2819a92fe3..558954f761 100644
--- a/crates/proc-macro-api/src/bidirectional_protocol/msg.rs
+++ b/crates/proc-macro-api/src/bidirectional_protocol/msg.rs
@@ -10,16 +10,16 @@ use crate::{
#[derive(Debug, Serialize, Deserialize)]
pub enum SubRequest {
- FileName { file_id: u32 },
+ FilePath { file_id: u32 },
SourceText { file_id: u32, start: u32, end: u32 },
- LocalFileName { file_id: u32 },
+ LocalFilePath { file_id: u32 },
}
#[derive(Debug, Serialize, Deserialize)]
pub enum SubResponse {
- FileNameResult { name: String },
+ FilePathResult { name: String },
SourceTextResult { text: Option<String> },
- LocalFileNameResult { name: Option<String> },
+ LocalFilePathResult { name: Option<String> },
}
#[derive(Debug, Serialize, Deserialize)]
diff --git a/crates/proc-macro-srv-cli/src/main_loop.rs b/crates/proc-macro-srv-cli/src/main_loop.rs
index 77cb8760a1..8fe3e93e47 100644
--- a/crates/proc-macro-srv-cli/src/main_loop.rs
+++ b/crates/proc-macro-srv-cli/src/main_loop.rs
@@ -186,9 +186,9 @@ impl<'a, C: Codec> ProcMacroClientHandle<'a, C> {
impl<C: Codec> proc_macro_srv::ProcMacroClientInterface for ProcMacroClientHandle<'_, C> {
fn file(&mut self, file_id: u32) -> String {
- match self.roundtrip(bidirectional::SubRequest::FileName { file_id }) {
+ match self.roundtrip(bidirectional::SubRequest::FilePath { file_id }) {
Some(bidirectional::BidirectionalMessage::SubResponse(
- bidirectional::SubResponse::FileNameResult { name },
+ bidirectional::SubResponse::FilePathResult { name },
)) => name,
_ => String::new(),
}
@@ -204,9 +204,9 @@ impl<C: Codec> proc_macro_srv::ProcMacroClientInterface for ProcMacroClientHandl
}
fn local_file(&mut self, file_id: u32) -> Option<String> {
- match self.roundtrip(bidirectional::SubRequest::LocalFileName { file_id }) {
+ match self.roundtrip(bidirectional::SubRequest::LocalFilePath { file_id }) {
Some(bidirectional::BidirectionalMessage::SubResponse(
- bidirectional::SubResponse::LocalFileNameResult { name },
+ bidirectional::SubResponse::LocalFilePathResult { name },
)) => name,
_ => None,
}