The shared decorator-name normalization.
(raw: &str)
| 1928 | |
| 1929 | /// The shared decorator-name normalization. |
| 1930 | fn strip_generic_and_qualifier(raw: &str) -> String { |
| 1931 | let mut name = raw.to_string(); |
| 1932 | if let Some(lt) = name.find('<') { |
| 1933 | if lt > 0 { |
| 1934 | name.truncate(lt); |
| 1935 | } |
| 1936 | } |
| 1937 | let last_dot = name |
| 1938 | .rfind('.') |
| 1939 | .map(|i| i as isize) |
| 1940 | .unwrap_or(-1) |
| 1941 | .max(name.rfind("::").map(|i| i as isize).unwrap_or(-1)); |
| 1942 | if last_dot >= 0 { |
| 1943 | name = name[(last_dot as usize + 1)..].to_string(); |
| 1944 | if name.starts_with(':') || name.starts_with('.') { |
| 1945 | name.remove(0); |
| 1946 | } |
| 1947 | } |
| 1948 | name.trim().to_string() |
| 1949 | } |
| 1950 | |
| 1951 | fn opt_str(arena: &mut Arena, s: Option<&str>) -> StrRef { |
| 1952 | match s { |