bench514a1855a
vim: use as_chunks for quote pairs
Clippy on Rust 1.99 (CI's stable) flags chunks_exact with a constant size.
+5 −3
1 file changed
| @@ -382,9 +382,11 @@ impl Buf { | |||
| 382 | 382 | let e = self.line_end(pos); | |
| 383 | 383 | let quotes: Vec<usize> = (s..e).filter(|&i| self.c[i] == q).collect(); | |
| 384 | 384 | let pair = quotes | |
| 385 | − | .chunks_exact(2) | |
| 386 | − | .find(|p| pos <= p[1]) | |
| 387 | − | .map(|p| (p[0], p[1]))?; | |
| 385 | + | .as_chunks::<2>() | |
| 386 | + | .0 | |
| 387 | + | .iter() | |
| 388 | + | .find(|[_, close]| pos <= *close) | |
| 389 | + | .map(|&[open, close]| (open, close))?; | |
| 388 | 390 | let (open, close) = pair; | |
| 389 | 391 | if around { | |
| 390 | 392 | let mut b = close + 1; | |