Some clippy improvements

This commit is contained in:
Anne de Jong 2024-04-18 18:49:35 +02:00
parent 35d5d7f750
commit c20094fb3f
3 changed files with 7 additions and 7 deletions

View File

@ -14,7 +14,7 @@ struct Args {
fn main() -> Result<()> { fn main() -> Result<()> {
let args = Args::parse(); let args = Args::parse();
let write_all = args.matches.len() == 0; let write_all = args.matches.is_empty();
let mut smgr = StreamMgr::new(); let mut smgr = StreamMgr::new();
// Obtain list of devices // Obtain list of devices
@ -27,15 +27,15 @@ fn main() -> Result<()> {
// If no device name strings are given, we are outputting them all to a file. // If no device name strings are given, we are outputting them all to a file.
if write_all { if write_all {
let daqconfig = DaqConfig::newFromDeviceInfo(&dev); let daqconfig = DaqConfig::newFromDeviceInfo(dev);
daqconfig.serialize_TOML_file(&filename.clone().into())?; daqconfig.serialize_TOML_file(&filename.clone().into())?;
} else { } else {
// See if we find the name in the match list. // See if we find the name in the match list.
for m in args.matches.iter() { for m in args.matches.iter() {
let needle = m.to_lowercase(); let needle = m.to_lowercase();
let dev_lower = (&dev.device_name).to_lowercase(); let dev_lower = dev.device_name.to_lowercase();
if dev_lower.contains(&needle) { if dev_lower.contains(&needle) {
DaqConfig::newFromDeviceInfo(&dev) DaqConfig::newFromDeviceInfo(dev)
.serialize_TOML_file(&filename.clone().into())?; .serialize_TOML_file(&filename.clone().into())?;
} }
} }

View File

@ -1,6 +1,6 @@
use anyhow::Result; use anyhow::Result;
use crossbeam::channel::{unbounded, Receiver, TryRecvError}; use crossbeam::channel::{unbounded, Receiver, TryRecvError};
use lasprs::daq::{InStreamMsg, StreamHandler, StreamMgr, StreamStatus, StreamType}; use lasprs::daq::{StreamMgr, StreamStatus, StreamType};
use lasprs::siggen::Siggen; use lasprs::siggen::Siggen;
use std::io; use std::io;
use std::{thread, time}; use std::{thread, time};
@ -11,7 +11,7 @@ fn spawn_stdin_channel() -> Receiver<String> {
thread::spawn(move || 'tt: loop { thread::spawn(move || 'tt: loop {
let mut buffer = String::new(); let mut buffer = String::new();
io::stdin().read_line(&mut buffer).unwrap(); io::stdin().read_line(&mut buffer).unwrap();
if let Err(_) = tx.send(buffer) { if tx.send(buffer).is_err() {
break 'tt; break 'tt;
} }
}); });

View File

@ -1,7 +1,7 @@
//! Provides stream messages that come from a running stream //! Provides stream messages that come from a running stream
use crate::config::*; use crate::config::*;
use crate::daq::Qty; use crate::daq::Qty;
use crate::siggen::Siggen; use crate::siggen::{Siggen, Source};
use anyhow::{bail, Result}; use anyhow::{bail, Result};
use crossbeam::channel::Sender; use crossbeam::channel::Sender;
use std::any::TypeId; use std::any::TypeId;