Skip to content

Commit a0fa585

Browse files
Merge #7678
7678: Simplify find_crlf r=matklad a=michalmuskala This is both simpler to read and compiles to better code: https://rust.godbolt.org/z/MxKodv Co-authored-by: Michał Muskała <[email protected]>
2 parents 425c56a + e640fa9 commit a0fa585

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

crates/rust-analyzer/src/line_endings.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ impl LineEndings {
4646
return (src, LineEndings::Dos);
4747

4848
fn find_crlf(src: &[u8]) -> Option<usize> {
49-
src.iter().zip(src.iter().skip(1)).position(|it| it == (&b'\r', &b'\n'))
49+
src.windows(2).position(|it| it == b"\r\n")
5050
}
5151
}
5252
}

0 commit comments

Comments
 (0)