@@ -162,8 +162,8 @@ pub struct UseScratch {
162
162
}
163
163
164
164
impl UseScratch {
165
- pub fn new ( ) -> UseScratch {
166
- UseScratch {
165
+ pub fn new ( ) -> Self {
166
+ Self {
167
167
buffer1 : capnp:: Word :: allocate_zeroed_vec ( SCRATCH_SIZE ) ,
168
168
buffer2 : capnp:: Word :: allocate_zeroed_vec ( SCRATCH_SIZE ) ,
169
169
}
@@ -174,7 +174,7 @@ impl<'a> Scratch<'a> for UseScratch {
174
174
type Allocator = message:: ScratchSpaceHeapAllocator < ' a > ;
175
175
176
176
fn get_allocators ( & ' a mut self ) -> ( Self :: Allocator , Self :: Allocator ) {
177
- let UseScratch { buffer1, buffer2 } = self ;
177
+ let Self { buffer1, buffer2 } = self ;
178
178
(
179
179
message:: ScratchSpaceHeapAllocator :: new ( capnp:: Word :: words_to_bytes_mut ( buffer1) ) ,
180
180
message:: ScratchSpaceHeapAllocator :: new ( capnp:: Word :: words_to_bytes_mut ( buffer2) ) ,
@@ -374,13 +374,13 @@ pub enum Mode {
374
374
}
375
375
376
376
impl Mode {
377
- pub fn parse ( s : & str ) -> :: capnp:: Result < Mode > {
377
+ pub fn parse ( s : & str ) -> :: capnp:: Result < Self > {
378
378
match s {
379
- "object" => Ok ( Mode :: Object ) ,
380
- "bytes" => Ok ( Mode :: Bytes ) ,
381
- "client" => Ok ( Mode :: Client ) ,
382
- "server" => Ok ( Mode :: Server ) ,
383
- "pipe" => Ok ( Mode :: Pipe ) ,
379
+ "object" => Ok ( Self :: Object ) ,
380
+ "bytes" => Ok ( Self :: Bytes ) ,
381
+ "client" => Ok ( Self :: Client ) ,
382
+ "server" => Ok ( Self :: Server ) ,
383
+ "pipe" => Ok ( Self :: Pipe ) ,
384
384
s => Err ( :: capnp:: Error :: failed ( format ! ( "unrecognized mode: {}" , s) ) ) ,
385
385
}
386
386
}
0 commit comments