mirror of
https://github.com/rust-lang/rustlings.git
synced 2024-12-27 00:00:03 +03:00
Use shrink to fit before leaking the vector
This commit is contained in:
parent
787bec9875
commit
b15e0a279b
|
@ -85,8 +85,10 @@ Did you already install Rust?
|
||||||
Try running `cargo --version` to diagnose the problem.",
|
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 mut info_file = InfoFile::parse()?;
|
||||||
let exercises = InfoFile::parse()?.exercises.leak();
|
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)) {
|
if matches!(args.command, Some(Subcommands::Init)) {
|
||||||
init::init(exercises).context("Initialization failed")?;
|
init::init(exercises).context("Initialization failed")?;
|
||||||
|
|
Loading…
Reference in a new issue