From 8317c8db1ae812bb608809153d78fb9c19b48a72 Mon Sep 17 00:00:00 2001 From: Ddystopia Date: Wed, 26 Apr 2023 19:55:17 +0200 Subject: [PATCH] Test for Builtin Type --- crates/ide/src/doc_links.rs | 2 +- crates/ide/src/doc_links/tests.rs | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/crates/ide/src/doc_links.rs b/crates/ide/src/doc_links.rs index 017ca48e3b0..b4f06e12d97 100644 --- a/crates/ide/src/doc_links.rs +++ b/crates/ide/src/doc_links.rs @@ -473,7 +473,7 @@ fn get_doc_base_urls( // https://github.com/rust-lang/rust-analyzer/issues/12250 if let Definition::BuiltinType(..) = def { let weblink = Url::parse("https://doc.rust-lang.org/nightly/core/").ok(); - return (weblink, local_doc_path); + return (weblink, None); }; let Some(krate) = def.krate(db) else { return Default::default() }; diff --git a/crates/ide/src/doc_links/tests.rs b/crates/ide/src/doc_links/tests.rs index 21bd9fb3217..4159d3ed816 100644 --- a/crates/ide/src/doc_links/tests.rs +++ b/crates/ide/src/doc_links/tests.rs @@ -119,6 +119,19 @@ fn node_to_def( }) } +#[test] +fn external_docs_doc_builtin_type() { + check_external_docs( + r#" +//- /main.rs crate:foo +let x: u3$02 = 0; +"#, + Some(&OsStr::new("/home/user/project")), + Some(expect![[r#"https://doc.rust-lang.org/nightly/core/primitive.u32.html"#]]), + None, + ); +} + #[test] fn external_docs_doc_url_crate() { check_external_docs(