@@ -6,8 +6,8 @@ use std::collections::HashMap;
66use std:: io:: { self , Write } ;
77use std:: str:: { self , FromStr } ;
88
9- use clap:: ValueEnum ;
109use clap:: builder:: PossibleValue ;
10+ use clap:: ValueEnum ;
1111use memchr:: memchr;
1212use serde:: { Deserialize , Serialize } ;
1313use serde_bytes:: ByteBuf ;
@@ -116,35 +116,21 @@ impl<T> FileNode<T> {
116116 pub fn split_contents ( & self ) -> ( FileNode < ( ) > , Option < & T > ) {
117117 use self :: FileNode :: * ;
118118 match * self {
119- Regular { size, executable } => (
120- Regular {
121- size,
122- executable,
123- } ,
124- None ,
125- ) ,
119+ Regular { size, executable } => ( Regular { size, executable } , None ) ,
126120 Symlink { ref target } => (
127121 Symlink {
128122 target : target. clone ( ) ,
129123 } ,
130124 None ,
131125 ) ,
132- Directory { size, ref contents } => (
133- Directory {
134- size,
135- contents : ( ) ,
136- } ,
137- Some ( contents) ,
138- ) ,
126+ Directory { size, ref contents } => ( Directory { size, contents : ( ) } , Some ( contents) ) ,
139127 }
140128 }
141129
142130 /// Return the type of this file.
143131 pub fn get_type ( & self ) -> FileType {
144132 match * self {
145- FileNode :: Regular { executable, .. } => FileType :: Regular {
146- executable,
147- } ,
133+ FileNode :: Regular { executable, .. } => FileType :: Regular { executable } ,
148134 FileNode :: Directory { .. } => FileType :: Directory ,
149135 FileNode :: Symlink { .. } => FileType :: Symlink ,
150136 }
@@ -178,21 +164,15 @@ impl FileNode<()> {
178164 str:: from_utf8 ( buf)
179165 . ok ( )
180166 . and_then ( |s| s. parse ( ) . ok ( ) )
181- . map ( |size| Regular {
182- executable,
183- size,
184- } )
167+ . map ( |size| Regular { executable, size } )
185168 }
186169 b's' => Some ( Symlink {
187170 target : ByteBuf :: from ( buf) ,
188171 } ) ,
189172 b'd' => str:: from_utf8 ( buf)
190173 . ok ( )
191174 . and_then ( |s| s. parse ( ) . ok ( ) )
192- . map ( |size| Directory {
193- size,
194- contents : ( ) ,
195- } ) ,
175+ . map ( |size| Directory { size, contents : ( ) } ) ,
196176 _ => None ,
197177 } )
198178 }
@@ -235,10 +215,7 @@ impl FileTreeEntry {
235215
236216impl FileTree {
237217 pub fn regular ( size : u64 , executable : bool ) -> Self {
238- FileTree ( FileNode :: Regular {
239- size,
240- executable,
241- } )
218+ FileTree ( FileNode :: Regular { size, executable } )
242219 }
243220
244221 pub fn symlink ( target : ByteBuf ) -> Self {
0 commit comments