Don’t append variable ID if there is only one

This commit is contained in:
2020-05-22 19:43:41 +02:00
parent 499fa0c667
commit 9b7895a032
2 changed files with 31 additions and 4 deletions

View File

@@ -320,7 +320,11 @@ impl foliage::flavor::VariableDeclaration for VariableDeclaration
None => unreachable!("all variable IDs should be assigned at this point"),
};
write!(formatter, "{}{}", variable_name_prefix, variable_id + 1)
match variable_id
{
0 => write!(formatter, "{}", variable_name_prefix),
_ => write!(formatter, "{}{}", variable_name_prefix, variable_id),
}
},
}
}