File tree Expand file tree Collapse file tree 2 files changed +13
-17
lines changed Expand file tree Collapse file tree 2 files changed +13
-17
lines changed Original file line number Diff line number Diff line change @@ -198,20 +198,17 @@ impl Params {
198198 // Get the start and end indices of the randomized part of the template.
199199 //
200200 // For example, if the template is "abcXXXXyz", then `i` is 3 and `j` is 7.
201- let ( i, j) = match find_last_contiguous_block_of_xs ( & options. template ) {
202- None => {
203- let s = match options. suffix {
204- // If a suffix is specified, the error message includes the template without the suffix.
205- Some ( _) => options
206- . template
207- . chars ( )
208- . take ( options. template . len ( ) )
209- . collect :: < String > ( ) ,
210- None => options. template ,
211- } ;
212- return Err ( MkTempError :: TooFewXs ( s) ) ;
213- }
214- Some ( indices) => indices,
201+ let Some ( ( i, j) ) = find_last_contiguous_block_of_xs ( & options. template ) else {
202+ let s = match options. suffix {
203+ // If a suffix is specified, the error message includes the template without the suffix.
204+ Some ( _) => options
205+ . template
206+ . chars ( )
207+ . take ( options. template . len ( ) )
208+ . collect :: < String > ( ) ,
209+ None => options. template ,
210+ } ;
211+ return Err ( MkTempError :: TooFewXs ( s) ) ;
215212 } ;
216213
217214 // Combine the directory given as an option and the prefix of the template.
Original file line number Diff line number Diff line change @@ -143,9 +143,8 @@ fn find_stdout() -> UResult<File> {
143143 Ok ( t)
144144 }
145145 Err ( e1) => {
146- let home = match env:: var ( "HOME" ) {
147- Err ( _) => return Err ( NohupError :: OpenFailed ( internal_failure_code, e1) . into ( ) ) ,
148- Ok ( h) => h,
146+ let Ok ( home) = env:: var ( "HOME" ) else {
147+ return Err ( NohupError :: OpenFailed ( internal_failure_code, e1) . into ( ) ) ;
149148 } ;
150149 let mut homeout = PathBuf :: from ( home) ;
151150 homeout. push ( NOHUP_OUT ) ;
You can’t perform that action at this time.
0 commit comments