rustImplItemOwner (languages/rust.ts) — the type an item written directly in an impl block belongs to: `ValueHint` for the `type Err` of `impl FromStr for ValueHint`, then `ValueHint::Err`, as the impl's methods are. A type no single name stands for (`()`, `(A, B)`, `[u8]`, `u32`) is written as the impl writes it. Mirrored byte-for-byte — change both.
(&self, node: Node)
| 456 | /// `u32`) is written as the impl writes it. Mirrored byte-for-byte — |
| 457 | /// change both. |
| 458 | fn impl_item_owner(&self, node: Node) -> Option<String> { |
| 459 | let list = node.parent().filter(|p| p.kind() == "declaration_list")?; |
| 460 | let imp = list.parent().filter(|p| p.kind() == "impl_item")?; |
| 461 | let mut ty = imp.child_by_field_name("type")?; |
| 462 | while ty.kind() == "reference_type" { |
| 463 | ty = ty.child_by_field_name("type")?; |
| 464 | } |
| 465 | self.impl_type_name(Some(ty)).or_else(|| { |
| 466 | let words: Vec<&str> = |
| 467 | self.text(ty).split([' ', '\t', '\r', '\n']).filter(|w| !w.is_empty()).collect(); |
| 468 | Some(words.join(" ")) |
| 469 | }) |
| 470 | } |
| 471 | |
| 472 | // --- visitNode ------------------------------------------------------------ |
| 473 |
no test coverage detected