Skip to content

Commit

Permalink
Test for Builtin Type
Browse files Browse the repository at this point in the history
  • Loading branch information
Ddystopia committed Apr 26, 2023
1 parent bfafcd4 commit 34be699
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion crates/ide/src/doc_links.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() };
Expand Down
13 changes: 13 additions & 0 deletions crates/ide/src/doc_links/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 34be699

Please sign in to comment.