Skip to content

Commit 721dc89

Browse files
committed
Fix cargo clippy warnings.
1 parent 98ad580 commit 721dc89

File tree

4 files changed

+14
-21
lines changed
  • chirpstack-concentratord-2g4/src
  • chirpstack-concentratord-sx1301/src/wrapper
  • chirpstack-concentratord-sx1302/src/wrapper
  • libconcentratord/src

4 files changed

+14
-21
lines changed

chirpstack-concentratord-2g4/src/wrapper.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,8 @@ pub fn downlink_from_proto(
156156
..Default::default()
157157
};
158158

159-
if let Some(timing) = &tx_info.timing {
160-
if let Some(params) = &timing.parameters {
159+
if let Some(timing) = &tx_info.timing
160+
&& let Some(params) = &timing.parameters {
161161
match params {
162162
gw::timing::Parameters::Immediately(_) => {
163163
packet.tx_mode = hal::TxMode::Immediate;
@@ -190,10 +190,9 @@ pub fn downlink_from_proto(
190190
}
191191
}
192192
}
193-
}
194193

195-
if let Some(modulation) = &tx_info.modulation {
196-
if let Some(params) = &modulation.parameters {
194+
if let Some(modulation) = &tx_info.modulation
195+
&& let Some(params) = &modulation.parameters {
197196
match params {
198197
gw::modulation::Parameters::Lora(v) => {
199198
packet.bandwidth = v.bandwidth;
@@ -241,7 +240,6 @@ pub fn downlink_from_proto(
241240
}
242241
}
243242
}
244-
}
245243

246244
Ok(packet)
247245
}

chirpstack-concentratord-sx1301/src/wrapper/mod.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -210,8 +210,8 @@ pub fn downlink_from_proto(df: &gw::DownlinkFrameItem) -> Result<hal::TxPacket>
210210
..Default::default()
211211
};
212212

213-
if let Some(timing) = &tx_info.timing {
214-
if let Some(params) = &timing.parameters {
213+
if let Some(timing) = &tx_info.timing
214+
&& let Some(params) = &timing.parameters {
215215
match params {
216216
gw::timing::Parameters::Immediately(_) => {
217217
packet.modulation = hal::Modulation::LoRa;
@@ -262,10 +262,9 @@ pub fn downlink_from_proto(df: &gw::DownlinkFrameItem) -> Result<hal::TxPacket>
262262
}
263263
}
264264
}
265-
}
266265

267-
if let Some(modulation) = &tx_info.modulation {
268-
if let Some(params) = &modulation.parameters {
266+
if let Some(modulation) = &tx_info.modulation
267+
&& let Some(params) = &modulation.parameters {
269268
match params {
270269
gw::modulation::Parameters::Lora(v) => {
271270
packet.modulation = hal::Modulation::LoRa;
@@ -302,7 +301,6 @@ pub fn downlink_from_proto(df: &gw::DownlinkFrameItem) -> Result<hal::TxPacket>
302301
}
303302
}
304303
}
305-
}
306304

307305
Ok(packet)
308306
}

chirpstack-concentratord-sx1302/src/wrapper/mod.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -202,8 +202,8 @@ pub fn downlink_from_proto(df: &gw::DownlinkFrameItem) -> Result<hal::TxPacket>
202202
..Default::default()
203203
};
204204

205-
if let Some(timing) = &tx_info.timing {
206-
if let Some(params) = &timing.parameters {
205+
if let Some(timing) = &tx_info.timing
206+
&& let Some(params) = &timing.parameters {
207207
match params {
208208
gw::timing::Parameters::Immediately(_) => {
209209
packet.tx_mode = hal::TxMode::Immediate;
@@ -253,10 +253,9 @@ pub fn downlink_from_proto(df: &gw::DownlinkFrameItem) -> Result<hal::TxPacket>
253253
}
254254
}
255255
}
256-
}
257256

258-
if let Some(modulation) = &tx_info.modulation {
259-
if let Some(params) = &modulation.parameters {
257+
if let Some(modulation) = &tx_info.modulation
258+
&& let Some(params) = &modulation.parameters {
260259
match params {
261260
gw::modulation::Parameters::Lora(v) => {
262261
packet.modulation = hal::Modulation::LoRa;
@@ -293,7 +292,6 @@ pub fn downlink_from_proto(df: &gw::DownlinkFrameItem) -> Result<hal::TxPacket>
293292
}
294293
}
295294
}
296-
}
297295

298296
Ok(packet)
299297
}

libconcentratord/src/gpsd.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,14 @@ pub fn get_reader(server: &str) -> Result<BufReader<TcpStream>> {
4646
debug!("Watch response: {}", String::from_utf8(b.clone())?);
4747

4848
for device in &resp.devices {
49-
if let Some(driver) = &device.driver {
50-
if driver == "u-blox" {
49+
if let Some(driver) = &device.driver
50+
&& driver == "u-blox" {
5151
let config_str = format!("&{}=b5620601080001200001010000003294\r\n", device.path);
5252
debug!("Configuring uBlox device {} for NAV-TIMEGPS", device.path);
5353
writer.write_all(config_str.as_bytes())?;
5454
writer.flush()?;
5555
return Ok(reader);
5656
}
57-
}
5857
}
5958

6059
Err(anyhow!("No u-blox GNSS device found"))

0 commit comments

Comments
 (0)