Skip to content

Commit 2737def

Browse files
committed
Fixes clippy warnings
1 parent d669c8e commit 2737def

6 files changed

Lines changed: 34 additions & 34 deletions

File tree

src/acquire.rs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ impl Module {
232232
}
233233

234234
fn set_decimation(&self, args: &[String]) -> crate::Result {
235-
let decimation = match args.get(0) {
235+
let decimation = match args.first() {
236236
Some(decimation) => decimation.parse::<u32>().unwrap().into(),
237237
None => return Err(crate::Error::MissingParameter),
238238
};
@@ -255,7 +255,7 @@ impl Module {
255255
}
256256

257257
fn set_average(&self, args: &[String]) -> crate::Result {
258-
let average = match args.get(0) {
258+
let average = match args.first() {
259259
Some(average) => average.as_str() == "ON",
260260
None => return Err(crate::Error::MissingParameter),
261261
};
@@ -276,7 +276,7 @@ impl Module {
276276
}
277277

278278
fn set_trigger_source(&self, args: &[String]) -> crate::Result {
279-
let source = match args.get(0) {
279+
let source = match args.first() {
280280
Some(source) => source.clone().into(),
281281
None => return Err(crate::Error::MissingParameter),
282282
};
@@ -297,7 +297,7 @@ impl Module {
297297
}
298298

299299
fn set_trigger_delay(&self, args: &[String]) -> crate::Result {
300-
let delay = match args.get(0) {
300+
let delay = match args.first() {
301301
Some(delay) => delay.clone().parse().unwrap(),
302302
None => return Err(crate::Error::MissingParameter),
303303
};
@@ -314,7 +314,7 @@ impl Module {
314314
}
315315

316316
fn set_trigger_delay_ns(&self, args: &[String]) -> crate::Result {
317-
let delay = match args.get(0) {
317+
let delay = match args.first() {
318318
Some(delay) => delay.clone().parse().unwrap(),
319319
None => return Err(crate::Error::MissingParameter),
320320
};
@@ -331,7 +331,7 @@ impl Module {
331331
}
332332

333333
fn set_trigger_hyst(&self, args: &[String]) -> crate::Result {
334-
let hyst = match args.get(0) {
334+
let hyst = match args.first() {
335335
Some(hyst) => hyst.clone().parse().unwrap(),
336336
None => return Err(crate::Error::MissingParameter),
337337
};
@@ -348,7 +348,7 @@ impl Module {
348348
}
349349

350350
fn set_gain(&self, channel: redpitaya::Channel, args: &[String]) -> crate::Result {
351-
let gain = match args.get(0) {
351+
let gain = match args.first() {
352352
Some(gain) => gain.clone().into(),
353353
None => return Err(crate::Error::MissingParameter),
354354
};
@@ -369,7 +369,7 @@ impl Module {
369369
channel: redpitaya::acquire::trigger::Channel,
370370
args: &[String],
371371
) -> crate::Result {
372-
let level = match args.get(0) {
372+
let level = match args.first() {
373373
Some(level) => level.clone().parse().unwrap(),
374374
None => return Err(crate::Error::MissingParameter),
375375
};
@@ -398,7 +398,7 @@ impl Module {
398398
}
399399

400400
fn set_data_units(&mut self, args: &[String]) -> crate::Result {
401-
let unit = match args.get(0) {
401+
let unit = match args.first() {
402402
Some(arg) => arg.clone().into(),
403403
None => return Err(crate::Error::MissingParameter),
404404
};
@@ -413,7 +413,7 @@ impl Module {
413413
}
414414

415415
fn set_data_format(&mut self, args: &[String]) -> crate::Result {
416-
let format = match args.get(0) {
416+
let format = match args.first() {
417417
Some(format) => format.clone().into(),
418418
None => return Err(crate::Error::MissingParameter),
419419
};
@@ -424,7 +424,7 @@ impl Module {
424424
}
425425

426426
fn data_pos(&self, channel: redpitaya::Channel, args: &[String]) -> crate::Result {
427-
let start = match args.get(0) {
427+
let start = match args.first() {
428428
Some(start) => start.parse().unwrap(),
429429
None => return Err(crate::Error::MissingParameter),
430430
};
@@ -444,7 +444,7 @@ impl Module {
444444
}
445445

446446
fn data(&self, channel: redpitaya::Channel, args: &[String]) -> crate::Result {
447-
let start = match args.get(0) {
447+
let start = match args.first() {
448448
Some(start) => start.parse().unwrap(),
449449
None => return Err(crate::Error::MissingParameter),
450450
};
@@ -464,7 +464,7 @@ impl Module {
464464
}
465465

466466
fn oldest_data(&self, channel: redpitaya::Channel, args: &[String]) -> crate::Result {
467-
let size = match args.get(0) {
467+
let size = match args.first() {
468468
Some(end) => end.parse().unwrap(),
469469
None => return Err(crate::Error::MissingParameter),
470470
};
@@ -488,7 +488,7 @@ impl Module {
488488
}
489489

490490
fn latest_data(&self, channel: redpitaya::Channel, args: &[String]) -> crate::Result {
491-
let size = match args.get(0) {
491+
let size = match args.first() {
492492
Some(end) => end.parse().unwrap(),
493493
None => return Err(crate::Error::MissingParameter),
494494
};

src/analog.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ impl Module {
4848
}
4949

5050
fn set_pin_value(args: &[String]) -> crate::Result {
51-
let pin = match args.get(0) {
51+
let pin = match args.first() {
5252
Some(pin) => pin.clone().into(),
5353
None => return Err(crate::Error::MissingParameter),
5454
};
@@ -64,7 +64,7 @@ impl Module {
6464
}
6565

6666
fn pin_value(args: &[String]) -> crate::Result {
67-
let pin = match args.get(0) {
67+
let pin = match args.first() {
6868
Some(pin) => pin.clone().into(),
6969
None => return Err(crate::Error::MissingParameter),
7070
};

src/digital.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ impl Module {
5454
}
5555

5656
fn set_pin_state(args: &[String]) -> crate::Result {
57-
let pin = match args.get(0) {
57+
let pin = match args.first() {
5858
Some(pin) => pin.clone().into(),
5959
None => return Err(crate::Error::MissingParameter),
6060
};
@@ -70,7 +70,7 @@ impl Module {
7070
}
7171

7272
fn pin_state(args: &[String]) -> crate::Result {
73-
let pin = match args.get(0) {
73+
let pin = match args.first() {
7474
Some(pin) => pin.clone().into(),
7575
None => return Err(crate::Error::MissingParameter),
7676
};
@@ -81,7 +81,7 @@ impl Module {
8181
}
8282

8383
fn set_pin_direction(args: &[String]) -> crate::Result {
84-
let direction = match args.get(0) {
84+
let direction = match args.first() {
8585
Some(direction) => direction.clone().into(),
8686
None => return Err(crate::Error::MissingParameter),
8787
};
@@ -97,7 +97,7 @@ impl Module {
9797
}
9898

9999
fn pin_direction(args: &[String]) -> crate::Result {
100-
let pin = match args.get(0) {
100+
let pin = match args.first() {
101101
Some(pin) => pin.clone().into(),
102102
None => return Err(crate::Error::MissingParameter),
103103
};

src/general.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ impl Module {
6666
}
6767

6868
fn fpga_bitstream(args: &[String]) -> crate::Result {
69-
let Some(version) = args.get(0) else {
69+
let Some(version) = args.first() else {
7070
return Err(crate::Error::MissingParameter);
7171
};
7272

src/generator.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ impl Module {
153153
}
154154

155155
fn set_state(&self, channel: redpitaya::Channel, args: &[String]) -> crate::Result {
156-
let state = match args.get(0) {
156+
let state = match args.first() {
157157
Some(state) => state == "ON",
158158
None => return Err(crate::Error::MissingParameter),
159159
};
@@ -178,7 +178,7 @@ impl Module {
178178
}
179179

180180
fn set_frequency(&self, channel: redpitaya::Channel, args: &[String]) -> crate::Result {
181-
let freq = match args.get(0) {
181+
let freq = match args.first() {
182182
Some(freq) => freq.parse().unwrap(),
183183
None => return Err(crate::Error::MissingParameter),
184184
};
@@ -195,7 +195,7 @@ impl Module {
195195
}
196196

197197
fn set_function(&self, channel: redpitaya::Channel, args: &[String]) -> crate::Result {
198-
let function = match args.get(0) {
198+
let function = match args.first() {
199199
Some(function) => function.clone().into(),
200200
None => return Err(crate::Error::MissingParameter),
201201
};
@@ -212,7 +212,7 @@ impl Module {
212212
}
213213

214214
fn set_amplitude(&self, channel: redpitaya::Channel, args: &[String]) -> crate::Result {
215-
let amp = match args.get(0) {
215+
let amp = match args.first() {
216216
Some(amp) => amp.parse().unwrap(),
217217
None => return Err(crate::Error::MissingParameter),
218218
};
@@ -229,7 +229,7 @@ impl Module {
229229
}
230230

231231
fn set_offset(&self, channel: redpitaya::Channel, args: &[String]) -> crate::Result {
232-
let offset = match args.get(0) {
232+
let offset = match args.first() {
233233
Some(offset) => offset.parse().unwrap(),
234234
None => return Err(crate::Error::MissingParameter),
235235
};
@@ -246,7 +246,7 @@ impl Module {
246246
}
247247

248248
fn set_phase(&self, channel: redpitaya::Channel, args: &[String]) -> crate::Result {
249-
let phase = match args.get(0) {
249+
let phase = match args.first() {
250250
Some(phase) => phase.parse().unwrap(),
251251
None => return Err(crate::Error::MissingParameter),
252252
};
@@ -263,7 +263,7 @@ impl Module {
263263
}
264264

265265
fn set_duty_cycle(&self, channel: redpitaya::Channel, args: &[String]) -> crate::Result {
266-
let duty_cycle = match args.get(0) {
266+
let duty_cycle = match args.first() {
267267
Some(duty_cycle) => duty_cycle.parse().unwrap(),
268268
None => return Err(crate::Error::MissingParameter),
269269
};
@@ -307,7 +307,7 @@ impl Module {
307307
}
308308

309309
fn set_mode(&self, channel: redpitaya::Channel, args: &[String]) -> crate::Result {
310-
let mode = match args.get(0) {
310+
let mode = match args.first() {
311311
Some(mode) => mode.clone().into(),
312312
None => return Err(crate::Error::MissingParameter),
313313
};
@@ -324,7 +324,7 @@ impl Module {
324324
}
325325

326326
fn set_burst_count(&self, channel: redpitaya::Channel, args: &[String]) -> crate::Result {
327-
let burs_count = match args.get(0) {
327+
let burs_count = match args.first() {
328328
Some(burs_count) => burs_count.parse().unwrap(),
329329
None => return Err(crate::Error::MissingParameter),
330330
};
@@ -341,7 +341,7 @@ impl Module {
341341
}
342342

343343
fn set_burst_repetition(&self, channel: redpitaya::Channel, args: &[String]) -> crate::Result {
344-
let bust_repetition = match args.get(0) {
344+
let bust_repetition = match args.first() {
345345
Some(bust_repetition) => bust_repetition.parse().unwrap(),
346346
None => return Err(crate::Error::MissingParameter),
347347
};
@@ -358,7 +358,7 @@ impl Module {
358358
}
359359

360360
fn set_burst_period(&self, channel: redpitaya::Channel, args: &[String]) -> crate::Result {
361-
let burst_period = match args.get(0) {
361+
let burst_period = match args.first() {
362362
Some(burst_period) => burst_period.parse().unwrap(),
363363
None => return Err(crate::Error::MissingParameter),
364364
};
@@ -375,7 +375,7 @@ impl Module {
375375
}
376376

377377
fn set_trigger_source(&self, channel: redpitaya::Channel, args: &[String]) -> crate::Result {
378-
let source = match args.get(0) {
378+
let source = match args.first() {
379379
Some(source) => source.clone().into(),
380380
None => return Err(crate::Error::MissingParameter),
381381
};

src/server.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ impl Server {
152152
.map(ToString::to_string)
153153
.collect();
154154

155-
let command = match args.get(0) {
155+
let command = match args.first() {
156156
Some(command) => command.to_string(),
157157
None => return (Command::Error("Empty command".to_string()), Vec::new()),
158158
};

0 commit comments

Comments
 (0)