The `new ns.Foo ()` name normalization shared by instantiation / anonymous-class / decorator extraction: strip `<...` from the first `<` (index > 0), keep the segment after the last `.`/`::`, strip ONE leading `:` or `.`, trim.
(raw: &str)
| 1678 | /// (index > 0), keep the segment after the last `.`/`::`, strip ONE leading |
| 1679 | /// `:` or `.`, trim. |
| 1680 | fn strip_generic_and_qualifier(raw: &str) -> String { |
| 1681 | let mut name = raw.to_string(); |
| 1682 | if let Some(lt) = name.find('<') { |
| 1683 | if lt > 0 { |
| 1684 | name.truncate(lt); |
| 1685 | } |
| 1686 | } |
| 1687 | let last_dot = name |
| 1688 | .rfind('.') |
| 1689 | .map(|i| i as isize) |
| 1690 | .unwrap_or(-1) |
| 1691 | .max(name.rfind("::").map(|i| i as isize).unwrap_or(-1)); |
| 1692 | if last_dot >= 0 { |
| 1693 | name = name[(last_dot as usize + 1)..].to_string(); |
| 1694 | if name.starts_with(':') || name.starts_with('.') { |
| 1695 | name.remove(0); |
| 1696 | } |
| 1697 | } |
| 1698 | name.trim().to_string() |
| 1699 | } |
| 1700 | |
| 1701 | fn capitalize(name: &str) -> String { |
| 1702 | let mut chars = name.chars(); |
no test coverage detected