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)
| 450 | /// `u32`) is written as the impl writes it. Mirrored byte-for-byte — |
| 451 | /// change both. |
| 452 | fn impl_item_owner(&self, node: Node) -> Option<String> { |
| 453 | let list = node.parent().filter(|p| p.kind() == "declaration_list")?; |
| 454 | let imp = list.parent().filter(|p| p.kind() == "impl_item")?; |
| 455 | let mut ty = imp.child_by_field_name("type")?; |
| 456 | while ty.kind() == "reference_type" { |
| 457 | ty = ty.child_by_field_name("type")?; |
| 458 | } |
| 459 | self.impl_type_name(Some(ty)).or_else(|| { |
| 460 | let words: Vec<&str> = |
| 461 | self.text(ty).split([' ', '\t', '\r', '\n']).filter(|w| !w.is_empty()).collect(); |
| 462 | Some(words.join(" ")) |
| 463 | }) |
| 464 | } |
| 465 | |
| 466 | // --- visitNode ------------------------------------------------------------ |
| 467 |
no test coverage detected