Skip to content

Commit 585f8aa

Browse files
committed
clippy fixes for rust 1.75.0
1 parent c1cae4b commit 585f8aa

File tree

6 files changed

+8
-8
lines changed

6 files changed

+8
-8
lines changed

src/buffer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ impl AudioBuffer {
124124

125125
/// Number of samples per channel in this `AudioBuffer`
126126
pub fn length(&self) -> usize {
127-
self.channels.get(0).map(ChannelData::len).unwrap_or(0)
127+
self.channels.first().map(ChannelData::len).unwrap_or(0)
128128
}
129129

130130
/// Sample rate of this `AudioBuffer` in Hertz

src/context/online.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ impl AudioContext {
265265
let mut pending_msgs: Vec<_> = self.render_thread_init.ctrl_msg_recv.try_iter().collect();
266266

267267
// Acquire the active audio graph from the current render thread, shutting it down
268-
let graph = if matches!(pending_msgs.get(0), Some(ControlMessage::Startup { .. })) {
268+
let graph = if matches!(pending_msgs.first(), Some(ControlMessage::Startup { .. })) {
269269
// Handle the edge case where the previous backend was suspended for its entire lifetime.
270270
// In this case, the `Startup` control message was never processed.
271271
let msg = pending_msgs.remove(0);

src/param.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,15 +226,15 @@ impl AudioParamEventTimeline {
226226
}
227227

228228
fn unsorted_peek(&self) -> Option<&AudioParamEvent> {
229-
self.inner.get(0)
229+
self.inner.first()
230230
}
231231

232232
// panic if dirty, we are doing something wrong here
233233
fn peek(&self) -> Option<&AudioParamEvent> {
234234
if self.dirty {
235235
panic!("`AudioParamEventTimeline`: Invalid `.peek()` call, the queue is dirty");
236236
}
237-
self.inner.get(0)
237+
self.inner.first()
238238
}
239239

240240
fn next(&self) -> Option<&AudioParamEvent> {

src/render/graph.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ impl Node {
103103

104104
/// Get the current buffer for AudioParam values
105105
pub fn get_buffer(&self) -> &AudioRenderQuantum {
106-
self.outputs.get(0).unwrap()
106+
self.outputs.first().unwrap()
107107
}
108108
}
109109

src/render/thread.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ impl RenderThread {
204204

205205
for quantum in 0..num_frames {
206206
// Suspend at given times and run callbacks
207-
if suspend_callbacks.get(0).map(|&(q, _)| q) == Some(quantum) {
207+
if suspend_callbacks.first().map(|&(q, _)| q) == Some(quantum) {
208208
let callback = suspend_callbacks.remove(0).1;
209209
(callback)(context);
210210

@@ -243,7 +243,7 @@ impl RenderThread {
243243

244244
for quantum in 0..num_frames {
245245
// Suspend at given times and run callbacks
246-
if suspend_callbacks.get(0).map(|&(q, _)| q) == Some(quantum) {
246+
if suspend_callbacks.first().map(|&(q, _)| q) == Some(quantum) {
247247
let sender = suspend_callbacks.remove(0).1;
248248
sender.send(()).unwrap();
249249
resume_receiver.next().await;

src/worklet.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ impl AudioProcessor for AudioWorkletRenderer {
324324
// Create an iterator for the output channel counts without allocating, handling also the
325325
// case where self.output_channel_count is empty.
326326
let single_case = [inputs
327-
.get(0)
327+
.first()
328328
.map(|i| i.number_of_channels())
329329
.unwrap_or_default()];
330330
let output_channel_count = if self.output_channel_count.is_empty() {

0 commit comments

Comments
 (0)