mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-16 07:03:57 +00:00
fix negative trait bound in outline view (#14044)
This commit is contained in:
parent
f1b257f4eb
commit
28b7460db1
1 changed files with 24 additions and 1 deletions
|
@ -160,7 +160,10 @@ fn structure_node(node: &SyntaxNode) -> Option<StructureNode> {
|
||||||
let label = match target_trait {
|
let label = match target_trait {
|
||||||
None => format!("impl {}", target_type.syntax().text()),
|
None => format!("impl {}", target_type.syntax().text()),
|
||||||
Some(t) => {
|
Some(t) => {
|
||||||
format!("impl {} for {}", t.syntax().text(), target_type.syntax().text(),)
|
format!("impl {}{} for {}",
|
||||||
|
it.excl_token().map(|x| x.to_string()).unwrap_or_default(),
|
||||||
|
t.syntax().text(),
|
||||||
|
target_type.syntax().text(),)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -213,6 +216,26 @@ mod tests {
|
||||||
expect.assert_debug_eq(&structure)
|
expect.assert_debug_eq(&structure)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_nagative_trait_bound() {
|
||||||
|
let txt = r#"impl !Unpin for Test {}"#;
|
||||||
|
check(txt, expect![[r#"
|
||||||
|
[
|
||||||
|
StructureNode {
|
||||||
|
parent: None,
|
||||||
|
label: "impl !Unpin for Test",
|
||||||
|
navigation_range: 16..20,
|
||||||
|
node_range: 0..23,
|
||||||
|
kind: SymbolKind(
|
||||||
|
Impl,
|
||||||
|
),
|
||||||
|
detail: None,
|
||||||
|
deprecated: false,
|
||||||
|
},
|
||||||
|
]
|
||||||
|
"#]]);
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_file_structure() {
|
fn test_file_structure() {
|
||||||
check(
|
check(
|
||||||
|
|
Loading…
Reference in a new issue