Merge pull request #548 from xMAC94x/clippy

clippy fixes
This commit is contained in:
est31 2021-03-22 11:29:46 +01:00 • committed by GitHub
commit fbc0f71e21
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 13 deletions

View file

@ -387,7 +387,7 @@ impl Device {
}
}
if rates.len() == 0 {
if rates.is_empty() {
vec![(min_rate, max_rate)]
} else {
rates
@ -423,11 +423,11 @@ impl Device {
for channels in supported_channels.iter() {
for &(min_rate, max_rate) in sample_rates.iter() {
output.push(SupportedStreamConfigRange {
channels: channels.clone(),
channels: *channels,
min_sample_rate: SampleRate(min_rate as u32),
max_sample_rate: SampleRate(max_rate as u32),
buffer_size: buffer_size_range.clone(),
sample_format: sample_format,
sample_format,
});
}
}
@ -912,9 +912,12 @@ impl Stream {
let (tx, rx) = trigger();
// Clone the handle for passing into worker thread.
let stream = inner.clone();
let thread = thread::spawn(move || {
input_stream_worker(rx, &*stream, &mut data_callback, &mut error_callback);
});
let thread = thread::Builder::new()
.name("cpal_alsa_in".to_owned())
.spawn(move || {
input_stream_worker(rx, &*stream, &mut data_callback, &mut error_callback);
})
.unwrap();
Stream {
thread: Some(thread),
inner,
@ -934,9 +937,12 @@ impl Stream {
let (tx, rx) = trigger();
// Clone the handle for passing into worker thread.
let stream = inner.clone();
let thread = thread::spawn(move || {
output_stream_worker(rx, &*stream, &mut data_callback, &mut error_callback);
});
let thread = thread::Builder::new()
.name("cpal_alsa_out".to_owned())
.spawn(move || {
output_stream_worker(rx, &*stream, &mut data_callback, &mut error_callback);
})
.unwrap();
Stream {
thread: Some(thread),
inner,

View file

@ -100,8 +100,10 @@ impl Stream {
commands: rx,
};
let thread =
thread::spawn(move || run_input(run_context, &mut data_callback, &mut error_callback));
let thread = thread::Builder::new()
.name("cpal_wasapi_in".to_owned())
.spawn(move || run_input(run_context, &mut data_callback, &mut error_callback))
.unwrap();
Stream {
thread: Some(thread),
@ -129,8 +131,10 @@ impl Stream {
commands: rx,
};
let thread =
thread::spawn(move || run_output(run_context, &mut data_callback, &mut error_callback));
let thread = thread::Builder::new()
.name("cpal_wasapi_out".to_owned())
.spawn(move || run_output(run_context, &mut data_callback, &mut error_callback))
.unwrap();
Stream {
thread: Some(thread),