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)
| 1574 | /// (index > 0), keep the segment after the last `.`/`::`, strip ONE leading |
| 1575 | /// `:` or `.`, trim. |
| 1576 | fn strip_generic_and_qualifier(raw: &str) -> String { |
| 1577 | let mut name = raw.to_string(); |
| 1578 | if let Some(lt) = name.find('<') { |
| 1579 | if lt > 0 { |
| 1580 | name.truncate(lt); |
| 1581 | } |
| 1582 | } |
| 1583 | let last_dot = name |
| 1584 | .rfind('.') |
| 1585 | .map(|i| i as isize) |
| 1586 | .unwrap_or(-1) |
| 1587 | .max(name.rfind("::").map(|i| i as isize).unwrap_or(-1)); |
| 1588 | if last_dot >= 0 { |
| 1589 | name = name[(last_dot as usize + 1)..].to_string(); |
| 1590 | if name.starts_with(':') || name.starts_with('.') { |
| 1591 | name.remove(0); |
| 1592 | } |
| 1593 | } |
| 1594 | name.trim().to_string() |
| 1595 | } |
| 1596 | |
| 1597 | fn capitalize(name: &str) -> String { |
| 1598 | let mut chars = name.chars(); |
no outgoing calls
no test coverage detected