mirror of
https://github.com/rust-lang/rustlings.git
synced 2024-12-26 23:36:30 +00:00
Rename constant
This commit is contained in:
parent
d83c91edc6
commit
f1a60780b9
5 changed files with 12 additions and 12 deletions
|
@ -1,7 +1,7 @@
|
||||||
use anyhow::{bail, Context, Result};
|
use anyhow::{bail, Context, Result};
|
||||||
use clap::Subcommand;
|
use clap::Subcommand;
|
||||||
|
|
||||||
use crate::DEVELOPING_OFFICIAL_RUSTLINGS;
|
use crate::DEBUG_PROFILE;
|
||||||
|
|
||||||
mod check;
|
mod check;
|
||||||
mod init;
|
mod init;
|
||||||
|
@ -18,8 +18,8 @@ impl DevCommands {
|
||||||
pub fn run(self) -> Result<()> {
|
pub fn run(self) -> Result<()> {
|
||||||
match self {
|
match self {
|
||||||
DevCommands::Init => {
|
DevCommands::Init => {
|
||||||
if DEVELOPING_OFFICIAL_RUSTLINGS {
|
if DEBUG_PROFILE {
|
||||||
bail!("Disabled while developing the official Rustlings");
|
bail!("Disabled in the debug build");
|
||||||
}
|
}
|
||||||
|
|
||||||
init::init().context(INIT_ERR)
|
init::init().context(INIT_ERR)
|
||||||
|
|
|
@ -8,7 +8,7 @@ use std::{
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
info_file::{ExerciseInfo, InfoFile},
|
info_file::{ExerciseInfo, InfoFile},
|
||||||
CURRENT_FORMAT_VERSION, DEVELOPING_OFFICIAL_RUSTLINGS,
|
CURRENT_FORMAT_VERSION, DEBUG_PROFILE,
|
||||||
};
|
};
|
||||||
|
|
||||||
fn forbidden_char(input: &str) -> Option<char> {
|
fn forbidden_char(input: &str) -> Option<char> {
|
||||||
|
@ -193,7 +193,7 @@ pub fn check() -> Result<()> {
|
||||||
let info_file = InfoFile::parse()?;
|
let info_file = InfoFile::parse()?;
|
||||||
check_exercises(&info_file)?;
|
check_exercises(&info_file)?;
|
||||||
|
|
||||||
if DEVELOPING_OFFICIAL_RUSTLINGS {
|
if DEBUG_PROFILE {
|
||||||
check_cargo_toml(
|
check_cargo_toml(
|
||||||
&info_file.exercises,
|
&info_file.exercises,
|
||||||
include_str!("../../dev/Cargo.toml"),
|
include_str!("../../dev/Cargo.toml"),
|
||||||
|
|
|
@ -4,7 +4,7 @@ use anyhow::{Context, Result};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
info_file::{ExerciseInfo, InfoFile},
|
info_file::{ExerciseInfo, InfoFile},
|
||||||
DEVELOPING_OFFICIAL_RUSTLINGS,
|
DEBUG_PROFILE,
|
||||||
};
|
};
|
||||||
|
|
||||||
use super::check::{append_bins, bins_start_end_ind};
|
use super::check::{append_bins, bins_start_end_ind};
|
||||||
|
@ -30,7 +30,7 @@ fn update_cargo_toml(
|
||||||
pub fn update() -> Result<()> {
|
pub fn update() -> Result<()> {
|
||||||
let info_file = InfoFile::parse()?;
|
let info_file = InfoFile::parse()?;
|
||||||
|
|
||||||
if DEVELOPING_OFFICIAL_RUSTLINGS {
|
if DEBUG_PROFILE {
|
||||||
update_cargo_toml(
|
update_cargo_toml(
|
||||||
&info_file.exercises,
|
&info_file.exercises,
|
||||||
include_str!("../../dev/Cargo.toml"),
|
include_str!("../../dev/Cargo.toml"),
|
||||||
|
|
|
@ -7,7 +7,7 @@ use std::{
|
||||||
process::{Command, Output},
|
process::{Command, Output},
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::{info_file::Mode, DEVELOPING_OFFICIAL_RUSTLINGS};
|
use crate::{info_file::Mode, DEBUG_PROFILE};
|
||||||
|
|
||||||
pub struct TerminalFileLink<'a> {
|
pub struct TerminalFileLink<'a> {
|
||||||
path: &'a str,
|
path: &'a str,
|
||||||
|
@ -48,7 +48,7 @@ impl Exercise {
|
||||||
cmd.arg(command);
|
cmd.arg(command);
|
||||||
|
|
||||||
// A hack to make `cargo run` work when developing Rustlings.
|
// A hack to make `cargo run` work when developing Rustlings.
|
||||||
if DEVELOPING_OFFICIAL_RUSTLINGS && Path::new("tests").exists() {
|
if DEBUG_PROFILE && Path::new("tests").exists() {
|
||||||
cmd.arg("--manifest-path").arg("dev/Cargo.toml");
|
cmd.arg("--manifest-path").arg("dev/Cargo.toml");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ mod run;
|
||||||
mod watch;
|
mod watch;
|
||||||
|
|
||||||
const CURRENT_FORMAT_VERSION: u8 = 1;
|
const CURRENT_FORMAT_VERSION: u8 = 1;
|
||||||
const DEVELOPING_OFFICIAL_RUSTLINGS: bool = {
|
const DEBUG_PROFILE: bool = {
|
||||||
#[allow(unused_assignments, unused_mut)]
|
#[allow(unused_assignments, unused_mut)]
|
||||||
let mut debug_profile = false;
|
let mut debug_profile = false;
|
||||||
|
|
||||||
|
@ -79,8 +79,8 @@ fn main() -> Result<()> {
|
||||||
|
|
||||||
match args.command {
|
match args.command {
|
||||||
Some(Subcommands::Init) => {
|
Some(Subcommands::Init) => {
|
||||||
if DEVELOPING_OFFICIAL_RUSTLINGS {
|
if DEBUG_PROFILE {
|
||||||
bail!("Disabled while developing the official Rustlings");
|
bail!("Disabled in the debug build");
|
||||||
}
|
}
|
||||||
|
|
||||||
return init::init().context("Initialization failed");
|
return init::init().context("Initialization failed");
|
||||||
|
|
Loading…
Reference in a new issue