Skip to content

Commit

Permalink
Clippy 😍
Browse files Browse the repository at this point in the history
Signed-off-by: Klimenty Tsoutsman <klim@tsoutsman.com>
  • Loading branch information
tsoutsman committed Sep 8, 2023
1 parent 414b31f commit cd2b49b
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 9 deletions.
2 changes: 1 addition & 1 deletion applications/test_priority_scheduler/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ pub fn main(_args: Vec<String>) -> isize {
let periodic_task_1 = periodic_tb1.spawn().unwrap();

// Set the periods of the task
scheduler::set_priority(&periodic_task_1, 200).unwrap();
scheduler::set_priority(&periodic_task_1, 200);

// start the tasks
periodic_task_1.unblock().unwrap();
Expand Down
4 changes: 1 addition & 3 deletions kernel/scheduler_epoch/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,7 @@ impl Scheduler {
{
let chosen_task = self.queue.get(task_index).unwrap();
let modified_tokens = chosen_task.tokens_remaining.saturating_sub(1);

let task = self.update_and_move_to_end(task_index, modified_tokens);
task
self.update_and_move_to_end(task_index, modified_tokens)
} else {
None
}
Expand Down
7 changes: 3 additions & 4 deletions kernel/spawn/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,13 @@ pub fn init(
.spawn_restartable(None)?
.clone();

let scheduler;
cfg_if::cfg_if! {
if #[cfg(epoch_scheduler)] {
scheduler = scheduler_epoch::Scheduler::new(idle_task);
let scheduler = scheduler_epoch::Scheduler::new(idle_task);
} else if #[cfg(priority_scheduler)] {
scheduler = scheduler_priority::Scheduler::new(idle_task);
let scheduler = scheduler_priority::Scheduler::new(idle_task);
} else {
scheduler = scheduler_round_robin::Scheduler::new(idle_task);
let scheduler = scheduler_round_robin::Scheduler::new(idle_task);
}
}
task::scheduler::set_policy(cpu_id, scheduler);
Expand Down
2 changes: 1 addition & 1 deletion kernel/task/src/scheduler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ pub fn busyness(cpu_id: CpuId) -> Option<usize> {
///
/// Returns a guard which reverts the change when dropped.
pub fn inherit_priority(task: &TaskRef) -> PriorityInheritanceGuard<'_> {
let current_priority = super::with_current_task(|current_task| priority(current_task)).unwrap();
let current_priority = super::with_current_task(priority).unwrap();
let other_priority = priority(task);

if let (Some(current_priority), Some(other_priority)) =
Expand Down

0 comments on commit cd2b49b

Please sign in to comment.