Skip to content

Commit e764778

Browse files
committed
fix warning in keyberon
1 parent 76c3678 commit e764778

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

keyberon/src/layout.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -476,6 +476,12 @@ impl TapHoldTracker {
476476
}
477477
}
478478

479+
/// Errors that can occur when attempting to change an action
480+
pub enum ChangeActionError {
481+
/// The provided coordinates (layer, row and column) do not exist in the layout.
482+
OutOfBounds,
483+
}
484+
479485
#[derive(Default)]
480486
struct ActionContext {
481487
inside_oneshot: bool,
@@ -714,13 +720,13 @@ impl<const C: usize, const R: usize, const L: usize, T: 'static + Copy, K: 'stat
714720
coord: (u8, u8),
715721
layer: usize,
716722
action: Action<T, K>,
717-
) -> Result<(), ()> {
723+
) -> Result<(), ChangeActionError> {
718724
self.layers
719725
.get_mut(layer)
720726
.and_then(|l| l.get_mut(coord.0 as usize))
721727
.and_then(|l| l.get_mut(coord.1 as usize))
722728
.map(|a| *a = action)
723-
.ok_or(())
729+
.ok_or(ChangeActionError::OutOfBounds)
724730
}
725731
/// Get a copy of the action for a given key
726732
pub fn get_action(&mut self, coord: (u8, u8), layer: usize) -> Option<Action<T, K>> {

0 commit comments

Comments
 (0)