Skip to content

Commit f55e4d0

Browse files
committed
Get pointer from address of c directly
1 parent 34c343a commit f55e4d0

File tree

1 file changed

+2
-2
lines changed
  • library/std/src/sys/windows

1 file changed

+2
-2
lines changed

library/std/src/sys/windows/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,9 @@ pub fn unrolled_find_u16s(needle: u16, haystack: &[u16]) -> Option<usize> {
118118
start = &start[8..];
119119
}
120120

121-
for (i, c) in start.iter().enumerate() {
121+
for c in start {
122122
if *c == needle {
123-
return Some((start.as_ptr() as usize - ptr as usize) / 2 + i);
123+
return Some((c as *const u16 as usize - ptr as usize) / 2);
124124
}
125125
}
126126
None

0 commit comments

Comments
 (0)