Skip to content

Commit

Permalink
refactor(kernel): address the clippy::extra_unused_type_parameters
Browse files Browse the repository at this point in the history
…lint in `bad_id`
  • Loading branch information
yvt committed Mar 21, 2023
1 parent 77eee26 commit d576106
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 7 deletions.
3 changes: 1 addition & 2 deletions src/r3_kernel/src/event_group.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ impl<Traits: KernelTraits> System<Traits> {
unsafe fn event_group_cb(
this: EventGroupId,
) -> Result<&'static EventGroupCb<Traits>, NoAccessError> {
Traits::get_event_group_cb(this.get() - 1)
.ok_or_else(|| unsafe { crate::bad_id::<Traits>() })
Traits::get_event_group_cb(this.get() - 1).ok_or_else(|| unsafe { crate::bad_id() })
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/r3_kernel/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -973,7 +973,7 @@ impl<Traits: KernelCfg2> State<Traits> {
///
/// [object safety]: r3_core#object-safety
#[inline]
unsafe fn bad_id<Traits: KernelCfg2>() -> error::NoAccessError {
unsafe fn bad_id() -> error::NoAccessError {
// TODO: Support returning `NoAccess`
let _ = error::NoAccessError::NoAccess;
if cfg!(debug_assertion) {
Expand Down
2 changes: 1 addition & 1 deletion src/r3_kernel/src/mutex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ impl<Traits: KernelTraits> System<Traits> {
/// See [`crate::bad_id`].
#[inline]
unsafe fn mutex_cb(this: MutexId) -> Result<&'static MutexCb<Traits>, NoAccessError> {
Traits::get_mutex_cb(this.get() - 1).ok_or_else(|| unsafe { crate::bad_id::<Traits>() })
Traits::get_mutex_cb(this.get() - 1).ok_or_else(|| unsafe { crate::bad_id() })
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/r3_kernel/src/semaphore.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ impl<Traits: KernelTraits> System<Traits> {
unsafe fn semaphore_cb(
this: SemaphoreId,
) -> Result<&'static SemaphoreCb<Traits>, NoAccessError> {
Traits::get_semaphore_cb(this.get() - 1).ok_or_else(|| unsafe { crate::bad_id::<Traits>() })
Traits::get_semaphore_cb(this.get() - 1).ok_or_else(|| unsafe { crate::bad_id() })
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/r3_kernel/src/task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ impl<Traits: KernelTraits> System<Traits> {
/// See [`crate::bad_id`].
#[inline]
unsafe fn task_cb(this: TaskId) -> Result<&'static TaskCb<Traits>, NoAccessError> {
Traits::get_task_cb(this.get() - 1).ok_or_else(|| unsafe { crate::bad_id::<Traits>() })
Traits::get_task_cb(this.get() - 1).ok_or_else(|| unsafe { crate::bad_id() })
}

#[cfg_attr(not(feature = "inline_syscall"), inline(never))]
Expand Down
2 changes: 1 addition & 1 deletion src/r3_kernel/src/timer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ impl<Traits: KernelTraits> System<Traits> {
/// See [`crate::bad_id`].
#[inline]
unsafe fn timer_cb(this: TimerId) -> Result<&'static TimerCb<Traits>, NoAccessError> {
Traits::get_timer_cb(this.get() - 1).ok_or_else(|| unsafe { crate::bad_id::<Traits>() })
Traits::get_timer_cb(this.get() - 1).ok_or_else(|| unsafe { crate::bad_id() })
}
}

Expand Down

0 comments on commit d576106

Please sign in to comment.