(&mut self, text: &str)
| 374 | |
| 375 | #[allow(clippy::arithmetic_side_effects)] |
| 376 | fn write_attributes(&mut self, text: &str) -> Result<(), InlineError> { |
| 377 | let bytes = text.as_bytes(); |
| 378 | let mut last_end = 0; |
| 379 | |
| 380 | // Scan for '&' (0x26), '"' (0x22), and 0xC2 (first byte of \u{00A0}) |
| 381 | for idx in memchr3_iter(b'&', b'"', 0xC2, bytes) { |
| 382 | match bytes[idx] { |
| 383 | b'&' => { |
| 384 | self.writer.write_all(&bytes[last_end..idx])?; |
| 385 | self.writer.write_all(b"&")?; |
| 386 | last_end = idx + 1; |
| 387 | } |
| 388 | b'"' => { |
| 389 | self.writer.write_all(&bytes[last_end..idx])?; |
| 390 | self.writer.write_all(b""")?; |
| 391 | last_end = idx + 1; |
| 392 | } |
| 393 | 0xC2 if bytes.get(idx + 1) == Some(&0xA0) => { |
| 394 | self.writer.write_all(&bytes[last_end..idx])?; |
| 395 | self.writer.write_all(b" ")?; |
| 396 | last_end = idx + 2; // Skip both bytes of \u{00A0} |
| 397 | } |
| 398 | _ => {} // False positive for 0xC2 not followed by 0xA0 |
| 399 | } |
| 400 | } |
| 401 | self.writer.write_all(&bytes[last_end..])?; |
| 402 | Ok(()) |
| 403 | } |
| 404 | |
| 405 | #[allow(clippy::too_many_lines)] |
| 406 | fn start_elem( |
no test coverage detected