mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 11:31:15 +00:00
Ignore doc(hidden) attr if no body is present
This commit is contained in:
parent
c1c9e10f72
commit
b0101da116
@ -2245,6 +2245,37 @@ impl b::LocalTrait for B {
|
|||||||
fn no_skip_default_2() -> Option<()> {
|
fn no_skip_default_2() -> Option<()> {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
"#,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn doc_hidden_nondefault_member() {
|
||||||
|
check_assist(
|
||||||
|
add_missing_impl_members,
|
||||||
|
r#"
|
||||||
|
//- /lib.rs crate:b new_source_root:local
|
||||||
|
trait LocalTrait {
|
||||||
|
#[doc(hidden)]
|
||||||
|
fn no_skip_non_default() -> Option<()>;
|
||||||
|
|
||||||
|
#[doc(hidden)]
|
||||||
|
fn skip_default() -> Option<()> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//- /main.rs crate:a deps:b
|
||||||
|
struct B;
|
||||||
|
impl b::Loc$0alTrait for B {}
|
||||||
|
"#,
|
||||||
|
r#"
|
||||||
|
struct B;
|
||||||
|
impl b::LocalTrait for B {
|
||||||
|
fn no_skip_non_default() -> Option<()> {
|
||||||
|
${0:todo!()}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
|
@ -106,8 +106,18 @@ pub fn filter_assoc_items(
|
|||||||
.iter()
|
.iter()
|
||||||
.copied()
|
.copied()
|
||||||
.filter(|assoc_item| {
|
.filter(|assoc_item| {
|
||||||
!(ignore_items == IgnoreAssocItems::DocHiddenAttrPresent
|
if ignore_items == IgnoreAssocItems::DocHiddenAttrPresent
|
||||||
&& assoc_item.attrs(sema.db).has_doc_hidden())
|
&& assoc_item.attrs(sema.db).has_doc_hidden()
|
||||||
|
{
|
||||||
|
if let hir::AssocItem::Function(f) = assoc_item {
|
||||||
|
if !f.has_body(sema.db) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
})
|
})
|
||||||
// Note: This throws away items with no source.
|
// Note: This throws away items with no source.
|
||||||
.filter_map(|assoc_item| {
|
.filter_map(|assoc_item| {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user