diff options
| author | Lzu Tao <taolzu@gmail.com> | 2020-07-13 09:35:51 +0000 |
|---|---|---|
| committer | Lzu Tao <taolzu@gmail.com> | 2020-07-28 03:16:56 +0000 |
| commit | f55e4d036c10f5b887b4ed8c12b7b31f3bb75d23 (patch) | |
| tree | 89e10634a7e21e41a706d0c70e7c71d8ffe7a064 /library/std/src/sys/windows | |
| parent | 34c343ac27c519350577bd1bfdc4d1a3b90e6db6 (diff) | |
| download | rust-f55e4d036c10f5b887b4ed8c12b7b31f3bb75d23.tar.gz rust-f55e4d036c10f5b887b4ed8c12b7b31f3bb75d23.zip | |
Get pointer from address of c directly
Diffstat (limited to 'library/std/src/sys/windows')
| -rw-r--r-- | library/std/src/sys/windows/mod.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/library/std/src/sys/windows/mod.rs b/library/std/src/sys/windows/mod.rs index ef4041e92d7..982ec912c44 100644 --- a/library/std/src/sys/windows/mod.rs +++ b/library/std/src/sys/windows/mod.rs @@ -118,9 +118,9 @@ pub fn unrolled_find_u16s(needle: u16, haystack: &[u16]) -> Option<usize> { start = &start[8..]; } - for (i, c) in start.iter().enumerate() { + for c in start { if *c == needle { - return Some((start.as_ptr() as usize - ptr as usize) / 2 + i); + return Some((c as *const u16 as usize - ptr as usize) / 2); } } None |
