(code: &str, indent: &str)
| 351 | } |
| 352 | |
| 353 | fn indent_code(code: &str, indent: &str) -> String { |
| 354 | if code.is_empty() { |
| 355 | return format!("{}pass", indent); |
| 356 | } |
| 357 | code.lines() |
| 358 | .map(|line| format!("{}{}", indent, line)) |
| 359 | .collect::<Vec<_>>() |
| 360 | .join("\n") |
| 361 | } |
| 362 | |
| 363 | /// Render a Rust string as a Python string literal, escaped safely. |
| 364 | fn python_str_literal(s: &str) -> String { |
no test coverage detected