Fix load order verification
All checks were successful
lint/clippy Checking for common mistakes and opportunities for code improvement
build/msvc Build for the target platform: msvc
build/linux Build for the target platform: linux
All checks were successful
lint/clippy Checking for common mistakes and opportunities for code improvement
build/msvc Build for the target platform: msvc
build/linux Build for the target platform: linux
With `.enumerate()` after `.filter()`, the resulting indices didn't properly map back to the overall mod list anymore. But the checks afterwards relied on that. Moving the `.enumerate()` before the `.filter()` makes sure that the indices are correct.
This commit is contained in:
parent
91651a8467
commit
e6f1e7c117
1 changed files with 8 additions and 6 deletions
|
@ -162,18 +162,20 @@ where
|
||||||
|
|
||||||
pub(crate) fn check_mod_order(state: &ActionState) -> Result<()> {
|
pub(crate) fn check_mod_order(state: &ActionState) -> Result<()> {
|
||||||
if tracing::enabled!(tracing::Level::DEBUG) {
|
if tracing::enabled!(tracing::Level::DEBUG) {
|
||||||
let order = state.mods.iter().filter(|i| i.enabled).enumerate().fold(
|
let order = state
|
||||||
String::new(),
|
.mods
|
||||||
|mut s, (i, info)| {
|
.iter()
|
||||||
|
.enumerate()
|
||||||
|
.filter(|(_, i)| i.enabled)
|
||||||
|
.fold(String::new(), |mut s, (i, info)| {
|
||||||
s.push_str(&format!("{}: {} - {}\n", i, info.id, info.name));
|
s.push_str(&format!("{}: {} - {}\n", i, info.id, info.name));
|
||||||
s
|
s
|
||||||
},
|
});
|
||||||
);
|
|
||||||
|
|
||||||
tracing::debug!("Mod order:\n{}", order);
|
tracing::debug!("Mod order:\n{}", order);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i, mod_info) in state.mods.iter().filter(|i| i.enabled).enumerate() {
|
for (i, mod_info) in state.mods.iter().enumerate().filter(|(_, i)| i.enabled) {
|
||||||
for dep in &mod_info.depends {
|
for dep in &mod_info.depends {
|
||||||
let dep_info = state.mods.iter().enumerate().find(|(_, m)| m.id == dep.id);
|
let dep_info = state.mods.iter().enumerate().find(|(_, m)| m.id == dep.id);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue