File tree Expand file tree Collapse file tree 3 files changed +21
-24
lines changed
Expand file tree Collapse file tree 3 files changed +21
-24
lines changed Original file line number Diff line number Diff line change @@ -267,15 +267,15 @@ impl SfToolConfig {
267267 if stub_sub_count != 1 {
268268 return Err ( "stub must contain exactly one of write, clear, or read" . to_string ( ) ) ;
269269 }
270- if let Some ( ref stub_write) = stub. write {
271- if stub_write. files . is_empty ( ) {
272- return Err ( "stub.write.files must not be empty" . to_string ( ) ) ;
273- }
270+ if let Some ( ref stub_write) = stub. write
271+ && stub_write. files . is_empty ( )
272+ {
273+ return Err ( "stub.write.files must not be empty" . to_string ( ) ) ;
274274 }
275- if let Some ( ref stub_clear) = stub. clear {
276- if stub_clear. files . is_empty ( ) {
277- return Err ( "stub.clear.files must not be empty" . to_string ( ) ) ;
278- }
275+ if let Some ( ref stub_clear) = stub. clear
276+ && stub_clear. files . is_empty ( )
277+ {
278+ return Err ( "stub.clear.files must not be empty" . to_string ( ) ) ;
279279 }
280280 if let Some ( ref stub_read) = stub. read {
281281 if stub_read. files . is_empty ( ) {
Original file line number Diff line number Diff line change @@ -66,11 +66,11 @@ fn main() -> Result<()> {
6666 return Ok ( ( ) ) ;
6767 }
6868 CommandSource :: Config ( cfg) => {
69- if let Some ( stub) = & cfg. stub {
70- if stub. write . is_some ( ) || stub. clear . is_some ( ) || stub. read . is_some ( ) {
71- execute_stub_config_command ( cfg ) ? ;
72- return Ok ( ( ) ) ;
73- }
69+ if let Some ( stub) = & cfg. stub
70+ && ( stub. write . is_some ( ) || stub. clear . is_some ( ) || stub. read . is_some ( ) )
71+ {
72+ execute_stub_config_command ( cfg ) ? ;
73+ return Ok ( ( ) ) ;
7474 }
7575 }
7676 _ => { }
Original file line number Diff line number Diff line change @@ -197,17 +197,14 @@ impl StubConfigSpec {
197197 } )
198198 . collect :: < Result < Vec < _ > > > ( ) ?;
199199
200- let pmic = match & self . pmic {
201- Some ( pmic) => Some ( lib:: PmicConfig {
202- disabled : pmic. disabled ,
203- scl_port : pmic. scl_port . into ( ) ,
204- scl_pin : pmic. scl_pin ,
205- sda_port : pmic. sda_port . into ( ) ,
206- sda_pin : pmic. sda_pin ,
207- channels : pmic. channels . iter ( ) . map ( |c| ( * c) . into ( ) ) . collect ( ) ,
208- } ) ,
209- None => None ,
210- } ;
200+ let pmic = self . pmic . as_ref ( ) . map ( |pmic| lib:: PmicConfig {
201+ disabled : pmic. disabled ,
202+ scl_port : pmic. scl_port . into ( ) ,
203+ scl_pin : pmic. scl_pin ,
204+ sda_port : pmic. sda_port . into ( ) ,
205+ sda_pin : pmic. sda_pin ,
206+ channels : pmic. channels . iter ( ) . map ( |c| ( * c) . into ( ) ) . collect ( ) ,
207+ } ) ;
211208
212209 let sd0 = match & self . sd0 {
213210 Some ( sd0) => Some ( lib:: Sd0Config {
You can’t perform that action at this time.
0 commit comments