File tree Expand file tree Collapse file tree 2 files changed +25
-6
lines changed Expand file tree Collapse file tree 2 files changed +25
-6
lines changed Original file line number Diff line number Diff line change 26
26
toolchain : stable
27
27
target : ${{ matrix.target }}
28
28
- run : cargo test --target=${{ matrix.target }}
29
+
30
+ style :
31
+ name : style
32
+ runs-on : ubuntu-latest
33
+ steps :
34
+ - uses : actions/checkout@v4
35
+ - uses : dtolnay/rust-toolchain@stable
36
+ with :
37
+ components : rustfmt
38
+ - name : cargo fmt --check
39
+ run : cargo fmt --all -- --check
Original file line number Diff line number Diff line change @@ -61,7 +61,11 @@ impl Hasher {
61
61
// self.buf.bytes[start..start+len].copy_from(buf);
62
62
for i in 0 ..len {
63
63
unsafe {
64
- * self . buf . bytes . assume_init_mut ( ) . get_unchecked_mut ( start + i) = * buf. get_unchecked ( i) ;
64
+ * self
65
+ . buf
66
+ . bytes
67
+ . assume_init_mut ( )
68
+ . get_unchecked_mut ( start + i) = * buf. get_unchecked ( i) ;
65
69
}
66
70
}
67
71
self . index = Index :: from ( start + len) ;
@@ -72,7 +76,9 @@ impl Default for Hasher {
72
76
#[ allow( deprecated) ]
73
77
fn default ( ) -> Self {
74
78
Hasher {
75
- buf : Buffer { bytes : MaybeUninit :: uninit ( ) } ,
79
+ buf : Buffer {
80
+ bytes : MaybeUninit :: uninit ( ) ,
81
+ } ,
76
82
index : Index :: _0,
77
83
processed : 0 ,
78
84
state : State ( 0 ) ,
@@ -142,15 +148,17 @@ impl core::hash::Hasher for Hasher {
142
148
// let (head, body) = bytes.split_at(4 - index);
143
149
let mid = 4 - index;
144
150
let head = unsafe { slice:: from_raw_parts ( bytes. as_ptr ( ) , mid) } ;
145
- let body = unsafe {
146
- slice:: from_raw_parts ( bytes. as_ptr ( ) . add ( mid) , len - mid)
147
- } ;
151
+ let body = unsafe { slice:: from_raw_parts ( bytes. as_ptr ( ) . add ( mid) , len - mid) } ;
148
152
149
153
// NOTE(unsafe) avoid calling `memcpy` on a 0-3 byte copy
150
154
// self.buf.bytes[index..].copy_from_slice(head);
151
155
for i in 0 ..4 - index {
152
156
unsafe {
153
- * self . buf . bytes . assume_init_mut ( ) . get_unchecked_mut ( index + i) = * head. get_unchecked ( i) ;
157
+ * self
158
+ . buf
159
+ . bytes
160
+ . assume_init_mut ( )
161
+ . get_unchecked_mut ( index + i) = * head. get_unchecked ( i) ;
154
162
}
155
163
}
156
164
You can’t perform that action at this time.
0 commit comments