Condense path joins
LPGhatguy opened this issue · 1 comments
LPGhatguy commented
Writing code like this:
let plugin_dir = user_dir
.join("AppData")
.join("Local")
.join("Roblox")
.join("Plugins");
...results in creation of several intermediate PathBuf
objects that are immediately thrown away. We should instead use join
for the first time we do this, and then PathBuf::push
for all other times. That will let us reuse the same PathBuf
object instead of copying and recopying all of its data multiple times.
Kampfkarren commented
Oof, I thought Rust would optimize this.