Skip to content

Commit 4985dd0

Browse files
jhodappcalebbourg
authored andcommitted
Get rid of unnecessary .ok().unwrap() statements and bubble any ProtocolErrors upward instead
1 parent c070022 commit 4985dd0

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

esp32-wroom-rp/src/spi.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -113,17 +113,17 @@ where
113113
.param(NinaSmallArrayParam::new(ssid))
114114
.param(NinaSmallArrayParam::new(passphrase));
115115

116-
self.execute(&operation).ok().unwrap();
116+
self.execute(&operation)?;
117117

118-
self.receive(&operation).ok().unwrap();
118+
self.receive(&operation)?;
119119
Ok(())
120120
}
121121

122122
fn get_conn_status(&mut self) -> Result<u8, ProtocolError> {
123123
let operation =
124124
Operation::new(NinaCommand::GetConnStatus, 1).with_no_params(NinaNoParams::new(""));
125125

126-
self.execute(&operation).ok().unwrap();
126+
self.execute(&operation)?;
127127

128128
let result = self.receive(&operation)?;
129129

@@ -134,9 +134,9 @@ where
134134
let dummy_param = NinaByteParam::from_bytes(&[ControlByte::Dummy as u8]);
135135
let operation = Operation::new(NinaCommand::Disconnect, 1).param(dummy_param);
136136

137-
self.execute(&operation).ok().unwrap();
137+
self.execute(&operation)?;
138138

139-
self.receive(&operation).ok().unwrap();
139+
self.receive(&operation)?;
140140

141141
Ok(())
142142
}

0 commit comments

Comments
 (0)