Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/ide/src/doc_links.rs')
| -rw-r--r-- | crates/ide/src/doc_links.rs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/crates/ide/src/doc_links.rs b/crates/ide/src/doc_links.rs index 8c47b809b9..dbdbfcd8eb 100644 --- a/crates/ide/src/doc_links.rs +++ b/crates/ide/src/doc_links.rs @@ -473,12 +473,17 @@ fn get_doc_base_url(db: &RootDatabase, krate: &Crate) -> Option<Url> { } _ => { krate.get_html_root_url(db).or_else(|| { + let version = krate.version(db); // Fallback to docs.rs. This uses `display_name` and can never be // correct, but that's what fallbacks are about. // // FIXME: clicking on the link should just open the file in the editor, // instead of falling back to external urls. - Some(format!("https://docs.rs/{krate}/*/", krate = display_name)) + Some(format!( + "https://docs.rs/{krate}/{version}/", + krate = display_name, + version = version.as_deref().unwrap_or("*") + )) })? } }; |