(name: &str)
| 336 | } |
| 337 | |
| 338 | fn sanitize_identifier(name: &str) -> String { |
| 339 | let mut out = String::new(); |
| 340 | for (i, c) in name.chars().enumerate() { |
| 341 | if c.is_alphanumeric() || c == '_' { |
| 342 | if i == 0 && c.is_ascii_digit() { |
| 343 | out.push('_'); |
| 344 | } |
| 345 | out.push(c); |
| 346 | } else { |
| 347 | out.push('_'); |
| 348 | } |
| 349 | } |
| 350 | if out.is_empty() { "_input".into() } else { out } |
| 351 | } |
| 352 | |
| 353 | fn indent_code(code: &str, indent: &str) -> String { |
| 354 | if code.is_empty() { |
no test coverage detected