(line: &str)
| 37 | } |
| 38 | |
| 39 | fn strip_comment(line: &str) -> &str { |
| 40 | // Comment markers inside quoted strings (e.g. `"res://path"`) are content. |
| 41 | let bytes = line.as_bytes(); |
| 42 | let mut in_string = false; |
| 43 | let mut i = 0; |
| 44 | while i < bytes.len() { |
| 45 | match bytes[i] { |
| 46 | b'"' => in_string = !in_string, |
| 47 | b'\\' if in_string => i += 1, |
| 48 | b'/' if !in_string && bytes.get(i + 1) == Some(&b'/') => return &line[..i], |
| 49 | b'#' if !in_string => return &line[..i], |
| 50 | _ => {} |
| 51 | } |
no test coverage detected