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
This commit is contained in:
Marshall Bowers 2024-06-17 11:55:53 -04:00 committed by GitHub
parent e8862c45cc
commit 2e87e1d26e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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 {