mirror of
https://github.com/rust-lang/rustlings.git
synced 2024-11-08 09:09:17 +01:00
Some renamings
This commit is contained in:
parent
99c9ab467b
commit
93f8d1610d
@ -41,11 +41,11 @@ pub enum Mode {
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
pub struct ExerciseList {
|
||||
pub struct InfoFile {
|
||||
pub exercises: Vec<Exercise>,
|
||||
}
|
||||
|
||||
impl ExerciseList {
|
||||
impl InfoFile {
|
||||
pub fn parse() -> Result<Self> {
|
||||
// Read a local `info.toml` if it exists.
|
||||
// Mainly to let the tests work for now.
|
||||
|
@ -56,7 +56,7 @@ fn create_vscode_dir() -> Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn init_rustlings(exercises: &[Exercise]) -> Result<()> {
|
||||
pub fn init(exercises: &[Exercise]) -> Result<()> {
|
||||
if Path::new("exercises").is_dir() && Path::new("Cargo.toml").is_file() {
|
||||
bail!(
|
||||
"A directory with the name `exercises` and a file with the name `Cargo.toml` already exist
|
||||
|
@ -16,7 +16,7 @@ mod verify;
|
||||
mod watch;
|
||||
|
||||
use crate::consts::WELCOME;
|
||||
use crate::exercise::{Exercise, ExerciseList};
|
||||
use crate::exercise::{Exercise, InfoFile};
|
||||
use crate::run::run;
|
||||
use crate::verify::verify;
|
||||
|
||||
@ -84,10 +84,10 @@ Did you already install Rust?
|
||||
Try running `cargo --version` to diagnose the problem.",
|
||||
)?;
|
||||
|
||||
let exercises = ExerciseList::parse()?.exercises;
|
||||
let exercises = InfoFile::parse()?.exercises;
|
||||
|
||||
if matches!(args.command, Some(Subcommands::Init)) {
|
||||
init::init_rustlings(&exercises).context("Initialization failed")?;
|
||||
init::init(&exercises).context("Initialization failed")?;
|
||||
println!(
|
||||
"\nDone initialization!\n
|
||||
Run `cd rustlings` to go into the generated directory.
|
||||
|
Loading…
Reference in New Issue
Block a user