Skip to content

Commit

Permalink
Upgrade to Rust v1.72
Browse files Browse the repository at this point in the history
  • Loading branch information
uklotzde committed Aug 25, 2023
1 parent eec3a75 commit fb2db2e
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ repos:
- id: codespell
args: [--ignore-words=.codespellignore]
- repo: https://github.com/sirosen/check-jsonschema
rev: 0.24.1
rev: 0.25.0
hooks:
- id: check-github-actions
- id: check-github-workflows
Expand Down
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ readme = "README.md"
repository = "https://github.com/uklotzde/djio"
keywords = ["dj", "controller", "midi", "hid"]
categories = ["hardware-support"]
rust-version = "1.72"
edition = "2021"
include = ["/src", "/README.md", "/LICENSES"]

Expand Down
1 change: 1 addition & 0 deletions src/devices/ni_traktor_kontrol_s4mk3/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ impl DeviceContext {
})
}

#[allow(clippy::missing_panics_doc)] // Never panics
pub fn detach(self) -> HidResult<HidDevice> {
log::info!("Terminating I/O thread");
self.command_tx
Expand Down
1 change: 1 addition & 0 deletions src/midi/midir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,7 @@ where
}

#[must_use]
#[allow(clippy::missing_panics_doc)] // Never panics
pub fn detect_dj_controllers(
&self,
device_descriptors: &[&MidiDeviceDescriptor],
Expand Down
24 changes: 24 additions & 0 deletions src/param/atomic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,55 +148,79 @@ impl AtomicValue {
}
}

/// # Panics
///
/// Panics if the value type does not match.
pub fn store_bool(&self, value: bool) {
debug_assert_eq!(self.value_type(), ValueType::Bool);
self.as_bool()
.expect("bool")
.store(value, ATOMIC_STORE_ORDERING);
}

/// # Panics
///
/// Panics if the value type does not match.
pub fn store_i32(&self, value: i32) {
debug_assert_eq!(self.value_type(), ValueType::I32);
self.as_i32()
.expect("i32")
.store(value, ATOMIC_STORE_ORDERING);
}

/// # Panics
///
/// Panics if the value type does not match.
pub fn store_u32(&self, value: u32) {
debug_assert_eq!(self.value_type(), ValueType::U32);
self.as_u32()
.expect("u32")
.store(value, ATOMIC_STORE_ORDERING);
}

/// # Panics
///
/// Panics if the value type does not match.
pub fn store_f32(&self, value: f32) {
debug_assert_eq!(self.value_type(), ValueType::F32);
self.as_f32()
.expect("f32")
.store(value, ATOMIC_STORE_ORDERING);
}

/// # Panics
///
/// Panics if the value type does not match.
pub fn swap_bool(&self, value: bool) -> bool {
debug_assert_eq!(self.value_type(), ValueType::Bool);
self.as_bool()
.expect("bool")
.swap(value, ATOMIC_STORE_ORDERING)
}

/// # Panics
///
/// Panics if the value type does not match.
pub fn swap_i32(&self, value: i32) -> i32 {
debug_assert_eq!(self.value_type(), ValueType::I32);
self.as_i32()
.expect("i32")
.swap(value, ATOMIC_STORE_ORDERING)
}

/// # Panics
///
/// Panics if the value type does not match.
pub fn swap_u32(&self, value: u32) -> u32 {
debug_assert_eq!(self.value_type(), ValueType::U32);
self.as_u32()
.expect("u32")
.swap(value, ATOMIC_STORE_ORDERING)
}

/// # Panics
///
/// Panics if the value type does not match.
pub fn swap_f32(&self, value: f32) -> f32 {
debug_assert_eq!(self.value_type(), ValueType::F32);
self.as_f32()
Expand Down

0 comments on commit fb2db2e

Please sign in to comment.