Skip to content

Commit

Permalink
Fix new warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
prokopyl committed Oct 20, 2024
1 parent 404adaf commit a4034bd
Show file tree
Hide file tree
Showing 40 changed files with 84 additions and 81 deletions.
12 changes: 6 additions & 6 deletions common/src/events/io/input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ impl<'a, I: InputEventBuffer> From<&'a I> for InputEvents<'a> {
}
}

impl<'a> InputEventBuffer for InputEvents<'a> {
impl InputEventBuffer for InputEvents<'_> {
#[inline]
fn len(&self) -> u32 {
InputEvents::len(self)
Expand All @@ -276,7 +276,7 @@ impl<'a> InputEventBuffer for InputEvents<'a> {

const INDEX_ERROR: &str = "Indexed InputEvents list out of bounds";

impl<'a> Index<usize> for InputEvents<'a> {
impl Index<usize> for InputEvents<'_> {
type Output = UnknownEvent;

#[inline]
Expand All @@ -285,7 +285,7 @@ impl<'a> Index<usize> for InputEvents<'a> {
}
}

impl<'a> Debug for InputEvents<'a> {
impl Debug for InputEvents<'_> {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
let mut list = f.debug_list();
for event in self {
Expand Down Expand Up @@ -314,7 +314,7 @@ impl<'a> InputEventsIter<'a> {
}
}

impl<'a> Clone for InputEventsIter<'a> {
impl Clone for InputEventsIter<'_> {
#[inline]
fn clone(&self) -> Self {
InputEventsIter {
Expand All @@ -337,14 +337,14 @@ impl<'a> Iterator for InputEventsIter<'a> {
}
}

impl<'a> ExactSizeIterator for InputEventsIter<'a> {
impl ExactSizeIterator for InputEventsIter<'_> {
#[inline]
fn len(&self) -> usize {
self.range.len()
}
}

impl<'a> DoubleEndedIterator for InputEventsIter<'a> {
impl DoubleEndedIterator for InputEventsIter<'_> {
#[inline]
fn next_back(&mut self) -> Option<Self::Item> {
self.range.next_back().and_then(|i| self.list.get(i))
Expand Down
2 changes: 1 addition & 1 deletion common/src/events/io/merger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pub struct EventMerger<'a, I1, I2> {
started: bool,
}

impl<'a, I1, I2> EventMerger<'a, I1, I2> {
impl<I1, I2> EventMerger<'_, I1, I2> {
/// Creates a new event merger from two iterators.
#[inline]
pub fn new(iter_1: I1, iter_2: I2) -> Self {
Expand Down
2 changes: 1 addition & 1 deletion common/src/events/io/output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ impl<'a, I: OutputEventBuffer> From<&'a mut I> for OutputEvents<'a> {
}
}

impl<'a> OutputEventBuffer for OutputEvents<'a> {
impl OutputEventBuffer for OutputEvents<'_> {
#[inline]
fn try_push(&mut self, event: &UnknownEvent) -> Result<(), TryPushError> {
OutputEvents::try_push(self, event)
Expand Down
2 changes: 1 addition & 1 deletion common/src/events/spaces/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ unsafe impl<'a> EventSpace<'a> for CoreEventSpace<'a> {
}
}

impl<'a> Debug for CoreEventSpace<'a> {
impl Debug for CoreEventSpace<'_> {
#[inline]
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
match self {
Expand Down
2 changes: 1 addition & 1 deletion common/src/events/spaces/id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ impl<'a, S: EventSpace<'a>> From<EventSpaceId<S>> for EventSpaceId<()> {
}
}

impl<'a> EventSpaceId<CoreEventSpace<'a>> {
impl EventSpaceId<CoreEventSpace<'_>> {
#[inline]
pub const fn core() -> Self {
Self {
Expand Down
4 changes: 2 additions & 2 deletions common/src/stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ impl<'a> InputStream<'a> {
}
}

impl<'a> Read for InputStream<'a> {
impl Read for InputStream<'_> {
fn read(&mut self, buf: &mut [u8]) -> std::io::Result<usize> {
let ret = if let Some(read) = self.0.read {
// SAFETY: this function pointer is guaranteed to be valid by from_raw_mut and from_reader
Expand Down Expand Up @@ -115,7 +115,7 @@ impl<'a> OutputStream<'a> {
}
}

impl<'a> Write for OutputStream<'a> {
impl Write for OutputStream<'_> {
fn write(&mut self, buf: &[u8]) -> std::io::Result<usize> {
let ret = if let Some(write) = self.0.write {
// SAFETY: this function pointer is guaranteed to be valid by from_raw_mut and from_reader
Expand Down
4 changes: 2 additions & 2 deletions extensions/src/audio_ports.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pub struct HostAudioPorts(RawExtension<HostExtensionSide, clap_host_audio_ports>
#[derive(Copy, Clone, Eq, PartialEq, Debug)]
pub struct AudioPortType<'a>(pub &'a CStr);

impl<'a> AudioPortType<'a> {
impl AudioPortType<'_> {
pub const MONO: AudioPortType<'static> = AudioPortType(CLAP_PORT_MONO);
pub const STEREO: AudioPortType<'static> = AudioPortType(CLAP_PORT_STEREO);

Expand Down Expand Up @@ -126,7 +126,7 @@ impl<'a> AudioPortInfo<'a> {
}
}

impl<'a> Debug for AudioPortInfo<'a> {
impl Debug for AudioPortInfo<'_> {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
f.debug_struct("AudioPortInfoData")
.field("id", &self.id)
Expand Down
2 changes: 1 addition & 1 deletion extensions/src/audio_ports/plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ pub struct AudioPortInfoWriter<'a> {
is_set: bool,
}

impl<'a> AudioPortInfoWriter<'a> {
impl AudioPortInfoWriter<'_> {
/// # Safety
///
/// The user must ensure the provided pointer is aligned and points to a valid allocation.
Expand Down
2 changes: 1 addition & 1 deletion extensions/src/audio_ports_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ pub struct MainPortInfo<'a> {
}

#[cfg(feature = "clack-host")]
impl<'a> MainPortInfo<'a> {
impl MainPortInfo<'_> {
/// # Safety
///
/// User must make sure port_type is either null or points to a NULL-terminated C string that
Expand Down
2 changes: 1 addition & 1 deletion extensions/src/audio_ports_config/plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ pub struct AudioPortConfigWriter<'a> {
is_set: bool,
}

impl<'a> AudioPortConfigWriter<'a> {
impl AudioPortConfigWriter<'_> {
/// # Safety
///
/// The user must ensure the provided pointer is aligned and points to a valid allocation.
Expand Down
4 changes: 2 additions & 2 deletions extensions/src/gui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ pub struct GuiConfiguration<'a> {
#[derive(Copy, Clone, PartialEq, Eq)]
pub struct GuiApiType<'a>(pub &'a CStr);

impl<'a> GuiApiType<'a> {
impl GuiApiType<'_> {
/// Represents the Win32 API used by Windows.
///
/// This API uses physical size for pixels.
Expand Down Expand Up @@ -454,7 +454,7 @@ impl<'a> GuiApiType<'a> {
}
}

impl<'a> Debug for GuiApiType<'a> {
impl Debug for GuiApiType<'_> {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
match self.0.to_str() {
Ok(s) => f.write_str(s),
Expand Down
4 changes: 2 additions & 2 deletions extensions/src/gui/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ const _: () = {
};

// SAFETY: this type ensures the handles are valid and are consistent across calls
unsafe impl<'a> HasRawWindowHandle for Window<'a> {
unsafe impl HasRawWindowHandle for Window<'_> {
fn raw_window_handle(&self) -> RawWindowHandle {
let api_type = self.api_type();

Expand Down Expand Up @@ -223,7 +223,7 @@ const _: () = {
use std::ptr::NonNull;

// SAFETY: The host ensures the underlying window handles are still valid
unsafe impl<'a> HasRawWindowHandle for Window<'a> {
unsafe impl HasRawWindowHandle for Window<'_> {
fn raw_window_handle(&self) -> Result<RawWindowHandle, HandleError> {
let api_type = self.api_type();

Expand Down
2 changes: 1 addition & 1 deletion extensions/src/note_name/plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ pub struct NoteNameWriter<'a> {
is_set: bool,
}

impl<'a> NoteNameWriter<'a> {
impl NoteNameWriter<'_> {
/// # Safety
///
/// The user must ensure the provided pointer is aligned and points to a valid allocation.
Expand Down
2 changes: 1 addition & 1 deletion extensions/src/note_ports/plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ pub struct NotePortInfoWriter<'a> {
is_set: bool,
}

impl<'a> NotePortInfoWriter<'a> {
impl NotePortInfoWriter<'_> {
/// # Safety
///
/// The user must ensure the provided pointer is aligned and points to a valid allocation.
Expand Down
4 changes: 2 additions & 2 deletions extensions/src/params/plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ pub struct ParamInfoWriter<'a> {
is_set: bool,
}

impl<'a> ParamInfoWriter<'a> {
impl ParamInfoWriter<'_> {
/// # Safety
///
/// The user must ensure the provided pointer is aligned and points to a valid allocation.
Expand Down Expand Up @@ -78,7 +78,7 @@ impl<'a> ParamDisplayWriter<'a> {
}
}

impl<'a> core::fmt::Write for ParamDisplayWriter<'a> {
impl core::fmt::Write for ParamDisplayWriter<'_> {
fn write_str(&mut self, s: &str) -> core::fmt::Result {
let s = s.as_bytes();
let requested_len = core::cmp::min(s.len(), self.remaining_len());
Expand Down
6 changes: 3 additions & 3 deletions host/examples/cpal/src/host.rs
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ impl HostLogImpl for CpalHostShared {
}
}

impl<'a> HostAudioPortsImpl for CpalHostMainThread<'a> {
impl HostAudioPortsImpl for CpalHostMainThread<'_> {
fn is_rescan_flag_supported(&self, _flag: RescanType) -> bool {
false
}
Expand All @@ -363,7 +363,7 @@ impl<'a> HostAudioPortsImpl for CpalHostMainThread<'a> {
}
}

impl<'a> HostNotePortsImpl for CpalHostMainThread<'a> {
impl HostNotePortsImpl for CpalHostMainThread<'_> {
fn supported_dialects(&self) -> NoteDialects {
NoteDialects::CLAP
}
Expand All @@ -373,7 +373,7 @@ impl<'a> HostNotePortsImpl for CpalHostMainThread<'a> {
}
}

impl<'a> HostParamsImplMainThread for CpalHostMainThread<'a> {
impl HostParamsImplMainThread for CpalHostMainThread<'_> {
fn rescan(&mut self, _flags: ParamRescanFlags) {
// We don't track param values at all
}
Expand Down
2 changes: 1 addition & 1 deletion host/examples/cpal/src/host/gui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ impl HostGuiImpl for CpalHostShared {
}
}

impl<'a> CpalHostMainThread<'a> {}
impl CpalHostMainThread<'_> {}

/// Tracks a plugin's GUI state and configuration.
pub struct Gui {
Expand Down
2 changes: 1 addition & 1 deletion host/examples/cpal/src/host/timer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use std::cell::{Cell, RefCell};
use std::collections::HashMap;
use std::time::{Duration, Instant};

impl<'a> HostTimerImpl for CpalHostMainThread<'a> {
impl HostTimerImpl for CpalHostMainThread<'_> {
fn register_timer(&mut self, period_ms: u32) -> Result<TimerId, HostError> {
Ok(self
.timers
Expand Down
2 changes: 2 additions & 0 deletions host/src/bundle/diva_stub.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(missing_docs)]

use clack_plugin::clack_entry;
use clack_plugin::prelude::*;

Expand Down
6 changes: 3 additions & 3 deletions host/src/host.rs
Original file line number Diff line number Diff line change
Expand Up @@ -318,9 +318,9 @@ pub trait HostHandlers: 'static {

// QoL implementations

impl<'a> AudioProcessorHandler<'a> for () {}
impl<'a> MainThreadHandler<'a> for () {}
impl<'a> SharedHandler<'a> for () {
impl AudioProcessorHandler<'_> for () {}
impl MainThreadHandler<'_> for () {}
impl SharedHandler<'_> for () {
fn request_restart(&self) {}
fn request_process(&self) {}
fn request_callback(&self) {}
Expand Down
6 changes: 3 additions & 3 deletions host/src/plugin/handle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,9 @@ pub struct PluginSharedHandle<'a> {
}

// SAFETY: The Shared handle only exposes thread-safe methods
unsafe impl<'a> Send for PluginSharedHandle<'a> {}
unsafe impl Send for PluginSharedHandle<'_> {}
// SAFETY: The Shared handle only exposes thread-safe methods
unsafe impl<'a> Sync for PluginSharedHandle<'a> {}
unsafe impl Sync for PluginSharedHandle<'_> {}

impl<'a> PluginSharedHandle<'a> {
/// # Safety
Expand Down Expand Up @@ -181,7 +181,7 @@ pub struct PluginAudioProcessorHandle<'a> {
}

// SAFETY: This type only exposes audio-thread methods
unsafe impl<'a> Send for PluginAudioProcessorHandle<'a> {}
unsafe impl Send for PluginAudioProcessorHandle<'_> {}

impl<'a> PluginAudioProcessorHandle<'a> {
pub(crate) fn new(raw: NonNull<clap_plugin>) -> Self {
Expand Down
4 changes: 2 additions & 2 deletions host/tests/call-in-destruction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ struct MyPluginMainThread {
data: String,
}

impl<'a> PluginMainThread<'a, ()> for MyPluginMainThread {}
impl PluginMainThread<'_, ()> for MyPluginMainThread {}

impl PluginStateImpl for MyPluginMainThread {
fn save(&mut self, output: &mut OutputStream) -> Result<(), PluginError> {
Expand Down Expand Up @@ -99,7 +99,7 @@ impl<'a> MainThreadHandler<'a> for MyHostMainThread<'a> {
}
}

impl<'a> Drop for MyHostMainThread<'a> {
impl Drop for MyHostMainThread<'_> {
fn drop(&mut self) {
let instance = self.instance.as_ref().unwrap();
assert!(instance.get_extension::<PluginState>().is_none());
Expand Down
4 changes: 2 additions & 2 deletions host/tests/drop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pub struct DivaPluginStubMainThread {
active: bool,
}

impl<'a> PluginMainThread<'a, ()> for DivaPluginStubMainThread {}
impl PluginMainThread<'_, ()> for DivaPluginStubMainThread {}

impl Plugin for DivaPluginStub {
type AudioProcessor<'a> = DivaPluginStubAudioProcessor;
Expand Down Expand Up @@ -105,7 +105,7 @@ impl Drop for DivaPluginStubMainThread {
pub static DIVA_STUB_ENTRY: EntryDescriptor = clack_entry!(SinglePluginEntry<DivaPluginStub>);

struct MyHostShared;
impl<'a> SharedHandler<'a> for MyHostShared {
impl SharedHandler<'_> for MyHostShared {
fn request_restart(&self) {
unreachable!()
}
Expand Down
4 changes: 2 additions & 2 deletions host/tests/instance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ pub struct DivaPluginStubAudioProcessor;
pub struct DivaPluginStub;
pub struct DivaPluginStubMainThread;

impl<'a> PluginMainThread<'a, ()> for DivaPluginStubMainThread {}
impl PluginMainThread<'_, ()> for DivaPluginStubMainThread {}

impl Plugin for DivaPluginStub {
type AudioProcessor<'a> = DivaPluginStubAudioProcessor;
Expand Down Expand Up @@ -60,7 +60,7 @@ impl<'a> PluginAudioProcessor<'a, (), DivaPluginStubMainThread> for DivaPluginSt
pub static DIVA_STUB_ENTRY: EntryDescriptor = clack_entry!(SinglePluginEntry<DivaPluginStub>);

struct MyHostShared;
impl<'a> SharedHandler<'a> for MyHostShared {
impl SharedHandler<'_> for MyHostShared {
fn request_restart(&self) {
unreachable!()
}
Expand Down
4 changes: 2 additions & 2 deletions host/tests/reentrant-init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ impl Plugin for MyPlugin {

struct MyPluginMainThread;

impl<'a> PluginMainThread<'a, ()> for MyPluginMainThread {}
impl PluginMainThread<'_, ()> for MyPluginMainThread {}

impl PluginTimerImpl for MyPluginMainThread {
fn on_timer(&mut self, timer_id: TimerId) {
Expand Down Expand Up @@ -91,7 +91,7 @@ impl<'a> MainThreadHandler<'a> for MyHostMainThread<'a> {
fn initialized(&mut self, _instance: InitializedPluginHandle<'a>) {}
}

impl<'a> HostTimerImpl for MyHostMainThread<'a> {
impl HostTimerImpl for MyHostMainThread<'_> {
fn register_timer(&mut self, period_ms: u32) -> Result<TimerId, HostError> {
assert_eq!(period_ms, 1000);

Expand Down
2 changes: 1 addition & 1 deletion host/tests/shared-state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ pub struct DivaPluginStubAudioProcessor;
pub struct DivaPluginStub;
pub struct DivaPluginStubMainThread;

impl<'a> PluginMainThread<'a, ()> for DivaPluginStubMainThread {}
impl PluginMainThread<'_, ()> for DivaPluginStubMainThread {}

impl Plugin for DivaPluginStub {
type AudioProcessor<'a> = DivaPluginStubAudioProcessor;
Expand Down
Loading

0 comments on commit a4034bd

Please sign in to comment.