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)
| 1563 | /// (index > 0), keep the segment after the last `.`/`::`, strip ONE leading |
| 1564 | /// `:` or `.`, trim. |
| 1565 | fn strip_generic_and_qualifier(raw: &str) -> String { |
| 1566 | let mut name = raw.to_string(); |
| 1567 | if let Some(lt) = name.find('<') { |
| 1568 | if lt > 0 { |
| 1569 | name.truncate(lt); |
| 1570 | } |
| 1571 | } |
| 1572 | let last_dot = name |
| 1573 | .rfind('.') |
| 1574 | .map(|i| i as isize) |
| 1575 | .unwrap_or(-1) |
| 1576 | .max(name.rfind("::").map(|i| i as isize).unwrap_or(-1)); |
| 1577 | if last_dot >= 0 { |
| 1578 | name = name[(last_dot as usize + 1)..].to_string(); |
| 1579 | if name.starts_with(':') || name.starts_with('.') { |
| 1580 | name.remove(0); |
| 1581 | } |
| 1582 | } |
| 1583 | name.trim().to_string() |
| 1584 | } |
| 1585 | |
| 1586 | fn capitalize(name: &str) -> String { |
| 1587 | let mut chars = name.chars(); |
no outgoing calls
no test coverage detected