It is easy to forget to add the final comma in the last item in
the workspace member list, thus the current heuristic breaks the
Cargo.toml parsing.
Instead of trying to append the gir item, it is inserted at
position end-2, avoiding the previous described situation.