@@ -553,15 +553,15 @@ pub(super) fn unlock_cpu_and_check_preemption<System: Kernel>(lock: utils::CpuLo
553553 let prev_task_priority = if let Some ( running_task) = System :: state ( ) . running_task ( ) {
554554 running_task. priority . to_usize ( ) . unwrap ( )
555555 } else {
556- usize:: max_value ( )
556+ usize:: MAX
557557 } ;
558558
559559 // The priority of the next task to run
560560 let next_task_priority = System :: state ( )
561561 . task_ready_bitmap
562562 . read ( & * lock)
563563 . find_set ( )
564- . unwrap_or ( usize:: max_value ( ) ) ;
564+ . unwrap_or ( usize:: MAX ) ;
565565
566566 // Relinquish CPU Lock
567567 drop ( lock) ;
@@ -593,30 +593,30 @@ pub(super) fn choose_next_running_task<System: Kernel>(
593593 if * running_task. st . read ( & * lock) == TaskSt :: Running {
594594 running_task. priority . to_usize ( ) . unwrap ( )
595595 } else {
596- usize:: max_value ( )
596+ usize:: MAX
597597 }
598598 } else {
599- usize:: max_value ( )
599+ usize:: MAX
600600 } ;
601601
602602 // The priority of the next task to run
603603 //
604- // The default value is `usize::max_value() - 1` for the following reason:
604+ // The default value is `usize::MAX - 1` for the following reason:
605605 // If `running_task` is in the Waiting state and there's no other task to
606606 // schedule at the moment, we want to assign `None` to `running_task`. In
607607 // this case, if the default value was the same as `prev_task_priority`,
608608 // `prev_task_priority` would be equal to `next_task_priority`, and the
609609 // `if` statement below would return too early. We make sure this does not
610610 // happen by making the default value of `next_task_priority` lower.
611611 //
612- // `usize::max_value() ` never collides with an actual task priority because
612+ // `usize::MAX - 1 ` never collides with an actual task priority because
613613 // of the priority range restriction imposed by `CfgBuilder::
614614 // num_task_priority_levels`.
615615 let next_task_priority = System :: state ( )
616616 . task_ready_bitmap
617617 . read ( & * lock)
618618 . find_set ( )
619- . unwrap_or ( usize:: max_value ( ) - 1 ) ;
619+ . unwrap_or ( usize:: MAX - 1 ) ;
620620
621621 // Return if there's no task willing to take over the current one, and
622622 // the current one can still run.
0 commit comments