Skip to content

Commit

Permalink
Fix warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
helgoboss committed Jun 13, 2024
1 parent 5208623 commit 340c099
Show file tree
Hide file tree
Showing 28 changed files with 569 additions and 1,014 deletions.
10 changes: 9 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 9 additions & 9 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -160,15 +160,15 @@ vst = { git = "https://github.com/helgoboss/vst-rs.git", branch = "feature/param
#vst = { path = "../vst-rs" }

# This is for temporary development with local reaper-rs.
[patch.'https://github.com/helgoboss/reaper-rs.git']
reaper-common-types = { path = "../reaper-rs/main/common-types" }
reaper-fluent = { path = "../reaper-rs/main/fluent" }
reaper-high = { path = "../reaper-rs/main/high" }
reaper-medium = { path = "../reaper-rs/main/medium" }
reaper-macros = { path = "../reaper-rs/main/macros" }
reaper-low = { path = "../reaper-rs/main/low" }
reaper-rx = { path = "../reaper-rs/main/rx" }
rppxml-parser = { path = "../reaper-rs/main/rppxml-parser" }
#[patch.'https://github.com/helgoboss/reaper-rs.git']
#reaper-common-types = { path = "../reaper-rs/main/common-types" }
#reaper-fluent = { path = "../reaper-rs/main/fluent" }
#reaper-high = { path = "../reaper-rs/main/high" }
#reaper-medium = { path = "../reaper-rs/main/medium" }
#reaper-macros = { path = "../reaper-rs/main/macros" }
#reaper-low = { path = "../reaper-rs/main/low" }
#reaper-rx = { path = "../reaper-rs/main/rx" }
#rppxml-parser = { path = "../reaper-rs/main/rppxml-parser" }

## This is for temporary development with local egui-baseview.
#[patch.'https://github.com/helgoboss/egui-baseview.git']
Expand Down
6 changes: 4 additions & 2 deletions api/src/persistence/preset.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
use crate::util::deserialize_null_default;
use std::collections::HashSet;

use semver::Version;
use serde::{Deserialize, Serialize};
use std::collections::{BTreeSet, HashSet};

use crate::util::deserialize_null_default;

/// Meta data that is common to both main and controller presets.
///
Expand Down
1 change: 0 additions & 1 deletion base/src/sound_player.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ use reaper_medium::{
PositionInSeconds, ReaperMutex, ReaperMutexGuard, ReaperVolumeValue,
};
use std::cell::Cell;
use std::path::Path;
use std::sync::Arc;

#[derive(Clone, Debug)]
Expand Down
2 changes: 1 addition & 1 deletion main/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "realearn"
version = "2.16.0-pre.14"
version = "2.16.0-pre.15"
authors = ["Benjamin Klum <[email protected]>"]
edition = "2021"
build = "build.rs"
Expand Down
2 changes: 1 addition & 1 deletion main/lib/helgoboss-learn
2 changes: 1 addition & 1 deletion main/src/application/unit_model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ use core::iter;
use helgoboss_learn::{AbsoluteMode, ControlResult, ControlValue, UnitValue};
use itertools::Itertools;
use realearn_api::persistence::{
CompartmentPresetId, FxDescriptor, MappingModification, TargetTouchCause, TrackDescriptor,
FxDescriptor, MappingModification, TargetTouchCause, TrackDescriptor,
VirtualControlElementCharacter,
};
use realearn_api::runtime::InstanceInfoEvent;
Expand Down
1 change: 0 additions & 1 deletion main/src/domain/lua_module_container.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ use mlua::{Function, Lua, Value};
use std::borrow::Cow;
use std::cell::RefCell;
use std::fs;
use std::path::PathBuf;
use std::rc::Rc;

/// Allows executing Lua code as a module that may require other modules.
Expand Down
16 changes: 8 additions & 8 deletions main/src/domain/lua_support.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,14 @@ impl SafeLua {
Ok(Self(lua))
}

pub fn from_value<T>(value: Value) -> anyhow::Result<T>
where
T: DeserializeOwned,
{
let result = T::deserialize(de::Deserializer::new(value))?;
Ok(result)
}

/// Compiles as a function with return value (for later execution).
pub fn compile_as_function<'a>(
&'a self,
Expand Down Expand Up @@ -84,14 +92,6 @@ impl SafeLua {
}
});
}

pub fn from_value<T>(&self, value: Value) -> anyhow::Result<T>
where
T: DeserializeOwned,
{
let result = T::deserialize(de::Deserializer::new(value))?;
Ok(result)
}
}

/// Creates a fresh environment for this Lua state.
Expand Down
22 changes: 9 additions & 13 deletions main/src/domain/targets/playtime_matrix_action_target.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ use crate::domain::{
CompartmentKind, ExtendedProcessorContext, ReaperTarget, TargetSection, TargetTypeDef,
UnresolvedReaperTargetDef, DEFAULT_TARGET,
};
use helgoboss_learn::{ControlValue, UnitValue};
use playtime_api::persistence::RecordLengthMode;

use realearn_api::persistence::PlaytimeMatrixAction;

#[derive(Debug)]
Expand Down Expand Up @@ -72,10 +69,10 @@ mod no_playtime_impl {
#[cfg(feature = "playtime")]
mod playtime_impl {
use crate::domain::{
convert_count_to_step_size, convert_unit_to_discrete_value, format_value_as_on_off,
Backbone, CompoundChangeEvent, ControlContext, HitResponse, MappingControlContext,
PlaytimeMatrixActionTarget, RealTimeControlContext, RealTimePlaytimeMatrixTarget,
RealTimeReaperTarget, RealearnTarget, ReaperTargetType, TargetCharacter,
convert_count_to_step_size, format_value_as_on_off, Backbone, CompoundChangeEvent,
ControlContext, HitResponse, MappingControlContext, PlaytimeMatrixActionTarget,
RealTimeControlContext, RealTimePlaytimeMatrixTarget, RealTimeReaperTarget, RealearnTarget,
ReaperTargetType, TargetCharacter,
};
use helgoboss_learn::{AbsoluteValue, ControlType, ControlValue, Fraction, Target, UnitValue};

Expand All @@ -85,7 +82,6 @@ mod playtime_impl {
use realearn_api::persistence::PlaytimeMatrixAction;

use std::borrow::Cow;
use std::str::FromStr;

impl PlaytimeMatrixActionTarget {
fn invoke(&self, matrix: &mut Matrix, value: ControlValue) -> anyhow::Result<HitResponse> {
Expand Down Expand Up @@ -316,11 +312,11 @@ mod playtime_impl {
},
PlaytimeMatrixAction::SmartRecord => match evt {
CompoundChangeEvent::ClipMatrix(ClipMatrixEvent::SlotChanged(
QualifiedSlotChangeEvent { event, .. },
)) => match event {
SlotChangeEvent::PlayState(_) => (true, None),
_ => (false, None),
},
QualifiedSlotChangeEvent {
event: SlotChangeEvent::PlayState(_),
..
},
)) => (true, None),
CompoundChangeEvent::ClipMatrix(ClipMatrixEvent::SequencerPlayStateChanged) => {
(true, None)
}
Expand Down
3 changes: 1 addition & 2 deletions main/src/domain/targets/playtime_row_action_target.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,7 @@ mod playtime_impl {
use playtime_api::persistence::RowAddress;
use playtime_api::runtime::CellAddress;
use playtime_clip_engine::base::ClipMatrixEvent;
use playtime_clip_engine::rt::{QualifiedSlotChangeEvent, SlotChangeEvent};
use realearn_api::persistence::{PlaytimeColumnAction, PlaytimeRowAction};
use realearn_api::persistence::PlaytimeRowAction;

impl PlaytimeRowActionTarget {
fn hit_internal(
Expand Down
2 changes: 1 addition & 1 deletion main/src/infrastructure/api/convert/from_data/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use crate::infrastructure::data::{
};
use helgoboss_learn::OscTypeTag;
use realearn_api::persistence;
use realearn_api::persistence::{ParamRef, VirtualControlElementCharacter};
use realearn_api::persistence::ParamRef;
pub use target::*;

fn convert_control_element_id(
Expand Down
2 changes: 1 addition & 1 deletion main/src/infrastructure/api/convert/to_data/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use enumflags2::BitFlags;
pub use mapping::*;
use realearn_api::persistence::{
ActivationCondition, Interval, Keystroke, ModifierState, OscArgKind, ParamRef,
VirtualControlElementCharacter, VirtualControlElementId,
VirtualControlElementId,
};
use reaper_medium::AcceleratorKeyCode;
use source::*;
Expand Down
1 change: 0 additions & 1 deletion main/src/infrastructure/data/osc_device_management.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ use std::cell::RefCell;
use std::error::Error;
use std::fs;
use std::net::{Ipv4Addr, SocketAddrV4, UdpSocket};
use std::path::PathBuf;
use std::rc::Rc;
use strum::EnumIs;

Expand Down
1 change: 0 additions & 1 deletion main/src/infrastructure/data/preset_link.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ use crate::application::{FxId, FxPresetLinkConfig, PresetLinkManager, PresetLink
use camino::Utf8PathBuf;
use std::cell::RefCell;
use std::fs;
use std::path::PathBuf;
use std::rc::Rc;

pub type SharedPresetLinkManager = Rc<RefCell<FileBasedPresetLinkManager>>;
Expand Down
16 changes: 6 additions & 10 deletions main/src/infrastructure/plugin/backbone_shell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ use base::{
};

use crate::base::allocator::{RealearnAllocatorIntegration, RealearnDeallocator, GLOBAL_ALLOCATOR};
use crate::base::notification::{notify_user_about_anyhow_error, notify_user_on_anyhow_error};
use crate::base::notification::notify_user_about_anyhow_error;
use crate::infrastructure::plugin::actions::ACTION_DEFS;
use crate::infrastructure::plugin::api_impl::{register_api, unregister_api};
use crate::infrastructure::plugin::debug_util::resolve_symbols_from_clipboard;
Expand Down Expand Up @@ -86,7 +86,6 @@ use std::cell::{Ref, RefCell};
use std::collections::{HashMap, HashSet};
use std::error::Error;
use std::future::Future;
use std::path::{Path, PathBuf};
use std::rc::{Rc, Weak};
use std::sync::atomic::{AtomicBool, AtomicU32, Ordering};
use std::sync::Arc;
Expand Down Expand Up @@ -367,17 +366,16 @@ impl BackboneShell {
// the actual presets are read from disk when waking up.
let controller_preset_manager = FileBasedControllerPresetManager::new(
CompartmentKind::Controller,
BackboneShell::realearn_compartment_preset_dir_path(CompartmentKind::Controller).into(),
BackboneShell::realearn_compartment_preset_dir_path(CompartmentKind::Controller),
Box::new(BackboneControllerPresetManagerEventHandler),
);
let main_preset_manager = FileBasedMainPresetManager::new(
CompartmentKind::Main,
BackboneShell::realearn_compartment_preset_dir_path(CompartmentKind::Main).into(),
BackboneShell::realearn_compartment_preset_dir_path(CompartmentKind::Main),
Box::new(BackboneMainPresetManagerEventHandler),
);
let preset_link_manager =
FileBasedPresetLinkManager::new(BackboneShell::realearn_auto_load_configs_dir_path())
.into();
FileBasedPresetLinkManager::new(BackboneShell::realearn_auto_load_configs_dir_path());
let controller_manager = ControllerManager::new(
Self::realearn_controller_config_file_path(),
Box::new(BackboneControllerManagerEventHandler),
Expand Down Expand Up @@ -1143,7 +1141,7 @@ impl BackboneShell {
.path()
.join("pot-preview.RPP");
fs::write(&dest_path, bytes).ok()?;
Some(dest_path.try_into().ok()?)
dest_path.try_into().ok()
});
PATH.as_ref().map(|p| p.as_path())
}
Expand Down Expand Up @@ -1651,7 +1649,7 @@ impl BackboneShell {
#[cfg(feature = "playtime")]
{
let result = playtime_impl::show_or_hide_playtime();
notify_user_on_anyhow_error(result);
crate::base::notification::notify_user_on_anyhow_error(result);
}
}

Expand Down Expand Up @@ -2843,7 +2841,6 @@ mod playtime_impl {
use reaper_high::{GroupingBehavior, Reaper};
use reaper_medium::{GangBehavior, InputMonitoringMode, RecordingInput};
use std::fs;
use std::path::PathBuf;

impl BackboneShell {
pub(crate) fn read_playtime_settings() -> Option<PlaytimeSettings> {
Expand Down Expand Up @@ -2900,7 +2897,6 @@ mod playtime_impl {
}

pub fn init_clip_engine(license_manager: &LicenseManager) {
use playtime_clip_engine::PlaytimeMainEngine;
#[derive(Debug)]
struct RealearnMetricsRecorder;
impl playtime_clip_engine::MetricsRecorder for RealearnMetricsRecorder {
Expand Down
Loading

0 comments on commit 340c099

Please sign in to comment.