From 2e87e1d26e86d0ce6f3d94b5d72782636330d24f Mon Sep 17 00:00:00 2001 From: Marshall Bowers Date: Mon, 17 Jun 2024 11:55:53 -0400 Subject: [PATCH] assistant: Fix loading local crate docs (#13147) This PR fixes an issue where loading the crate-level docs with `/rustdoc` wasn't working as expected. Release Notes: - N/A --- crates/assistant/src/slash_command/rustdoc_command.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/crates/assistant/src/slash_command/rustdoc_command.rs b/crates/assistant/src/slash_command/rustdoc_command.rs index 4eabc2821e..ecb6cee660 100644 --- a/crates/assistant/src/slash_command/rustdoc_command.rs +++ b/crates/assistant/src/slash_command/rustdoc_command.rs @@ -180,7 +180,14 @@ impl SlashCommand for RustdocSlashCommand { let item_path = item_path.clone(); async move { let item_docs = rustdoc_store - .load(crate_name.clone(), Some(item_path.join("::"))) + .load( + crate_name.clone(), + if item_path.is_empty() { + None + } else { + Some(item_path.join("::")) + }, + ) .await; if let Ok(item_docs) = item_docs {