@@ -162,8 +162,8 @@ pub struct UseScratch {
162162}
163163
164164impl UseScratch {
165- pub fn new ( ) -> UseScratch {
166- UseScratch {
165+ pub fn new ( ) -> Self {
166+ Self {
167167 buffer1 : capnp:: Word :: allocate_zeroed_vec ( SCRATCH_SIZE ) ,
168168 buffer2 : capnp:: Word :: allocate_zeroed_vec ( SCRATCH_SIZE ) ,
169169 }
@@ -174,7 +174,7 @@ impl<'a> Scratch<'a> for UseScratch {
174174 type Allocator = message:: ScratchSpaceHeapAllocator < ' a > ;
175175
176176 fn get_allocators ( & ' a mut self ) -> ( Self :: Allocator , Self :: Allocator ) {
177- let UseScratch { buffer1, buffer2 } = self ;
177+ let Self { buffer1, buffer2 } = self ;
178178 (
179179 message:: ScratchSpaceHeapAllocator :: new ( capnp:: Word :: words_to_bytes_mut ( buffer1) ) ,
180180 message:: ScratchSpaceHeapAllocator :: new ( capnp:: Word :: words_to_bytes_mut ( buffer2) ) ,
@@ -374,13 +374,13 @@ pub enum Mode {
374374}
375375
376376impl Mode {
377- pub fn parse ( s : & str ) -> :: capnp:: Result < Mode > {
377+ pub fn parse ( s : & str ) -> :: capnp:: Result < Self > {
378378 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 ) ,
384384 s => Err ( :: capnp:: Error :: failed ( format ! ( "unrecognized mode: {}" , s) ) ) ,
385385 }
386386 }
0 commit comments