mirror of
https://github.com/notohh/rustlings.git
synced 2024-11-21 13:32:23 -05:00
Use shrink to fit before leaking the vector
This commit is contained in:
parent
787bec9875
commit
b15e0a279b
1 changed files with 4 additions and 2 deletions
|
@ -85,8 +85,10 @@ Did you already install Rust?
|
|||
Try running `cargo --version` to diagnose the problem.",
|
||||
)?;
|
||||
|
||||
// Leaking is not a problem since the exercises are used until the end of the program.
|
||||
let exercises = InfoFile::parse()?.exercises.leak();
|
||||
let mut info_file = InfoFile::parse()?;
|
||||
info_file.exercises.shrink_to_fit();
|
||||
// Leaking is not a problem since the exercises' slice is used until the end of the program.
|
||||
let exercises = info_file.exercises.leak();
|
||||
|
||||
if matches!(args.command, Some(Subcommands::Init)) {
|
||||
init::init(exercises).context("Initialization failed")?;
|
||||
|
|
Loading…
Reference in a new issue