Skip to content

Commit

Permalink
Improve code
Browse files Browse the repository at this point in the history
  • Loading branch information
DerDrodt committed Oct 16, 2024
1 parent 0f59ca4 commit 16f7985
Showing 1 changed file with 2 additions and 16 deletions.
18 changes: 2 additions & 16 deletions src/csl/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1137,14 +1137,11 @@ fn substitute_subsequent_authors(
ns1.iter().zip(ns2.iter()).take_while(|(a, b)| a == b).count()
}

let mut i = 0;
let mut last_names = None;
let len = items.len();

while i < len {
let ec = &mut items[i].0;
for item in items.iter_mut() {
let ec = &mut item.0;
let Some(names_elem) = ec.find_meta(ElemMeta::Names) else {
i += 1;
continue;
};
let mut xnames = Vec::new();
Expand All @@ -1154,7 +1151,6 @@ fn substitute_subsequent_authors(
} else {
// No previous name; nothing to replace. Save and skip
last_names = Some(xnames);
i += 1;
continue;
};
match rule {
Expand All @@ -1164,8 +1160,6 @@ fn substitute_subsequent_authors(
replace_all(names, &subs);
} else {
last_names = Some(xnames.clone());
i += 1;
continue;
}
}
SubsequentAuthorSubstituteRule::CompleteEach => {
Expand All @@ -1174,8 +1168,6 @@ fn substitute_subsequent_authors(
replace_each(names, &subs);
} else {
last_names = Some(xnames.clone());
i += 1;
continue;
}
}
SubsequentAuthorSubstituteRule::PartialEach => {
Expand All @@ -1185,8 +1177,6 @@ fn substitute_subsequent_authors(
replace_first_n(nom, names, &subs);
} else {
last_names = Some(xnames.clone());
i += 1;
continue;
}
}
SubsequentAuthorSubstituteRule::PartialFirst => {
Expand All @@ -1196,13 +1186,9 @@ fn substitute_subsequent_authors(
replace_first_n(1, names, &subs);
} else {
last_names = Some(xnames.clone());
i += 1;
continue;
}
}
}

i += 1;
}
}
}
Expand Down

0 comments on commit 16f7985

Please sign in to comment.