Skip to content

Commit

Permalink
feat: improve code style
Browse files Browse the repository at this point in the history
  • Loading branch information
brglng committed Aug 23, 2024
1 parent ebe7561 commit d9d0288
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ fn pop_or_steal(queues: &[PathQueue], index: usize) -> Result<Option<PathBuf>> {
if let Some(path) = queues[index].pop()? {
Ok(Some(path))
} else {
for i in 0..queues.len() {
for (i, queue) in queues.iter().enumerate() {
if i != index {
if let Some(path) = queues[i].pop()? {
if let Some(path) = queue.pop()? {
return Ok(Some(path));
}
}
Expand All @@ -69,9 +69,9 @@ fn pop_or_steal(queues: &[PathQueue], index: usize) -> Result<Option<PathBuf>> {
fn push(queues: &[PathQueue], index: usize, path: PathBuf) -> Result<()> {
if let Some(mut path) = queues[index].push(path)? {
loop {
for i in 0..queues.len() {
for (i, queue) in queues.iter().enumerate() {
if i != index {
if let Some(p) = queues[i].push(path)? {
if let Some(p) = queue.push(path)? {
path = p;
} else {
return Ok(());
Expand Down

0 comments on commit d9d0288

Please sign in to comment.