mirror of
https://github.com/notohh/rustlings.git
synced 2024-10-30 16:59:12 -04:00
Check the format version in dev check
This commit is contained in:
parent
a2506f154b
commit
7f433ae28f
1 changed files with 7 additions and 3 deletions
|
@ -1,9 +1,9 @@
|
||||||
use anyhow::{bail, Context, Result};
|
use anyhow::{bail, Context, Result};
|
||||||
use std::fs;
|
use std::{cmp::Ordering, fs};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
info_file::{ExerciseInfo, InfoFile},
|
info_file::{ExerciseInfo, InfoFile},
|
||||||
DEVELOPING_OFFIFICAL_RUSTLINGS,
|
CURRENT_FORMAT_VERSION, DEVELOPING_OFFIFICAL_RUSTLINGS,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub fn bins_start_end_ind(cargo_toml: &str) -> Result<(usize, usize)> {
|
pub fn bins_start_end_ind(cargo_toml: &str) -> Result<(usize, usize)> {
|
||||||
|
@ -62,7 +62,11 @@ fn check_cargo_toml(
|
||||||
pub fn check() -> Result<()> {
|
pub fn check() -> Result<()> {
|
||||||
let info_file = InfoFile::parse()?;
|
let info_file = InfoFile::parse()?;
|
||||||
|
|
||||||
// TODO: Add checks
|
match info_file.format_version.cmp(&CURRENT_FORMAT_VERSION) {
|
||||||
|
Ordering::Less => bail!("`format_version` < {CURRENT_FORMAT_VERSION} (supported version)\nPlease migrate to the latest format version"),
|
||||||
|
Ordering::Greater => bail!("`format_version` > {CURRENT_FORMAT_VERSION} (supported version)\nTry updating the Rustlings program"),
|
||||||
|
Ordering::Equal => (),
|
||||||
|
}
|
||||||
|
|
||||||
if DEVELOPING_OFFIFICAL_RUSTLINGS {
|
if DEVELOPING_OFFIFICAL_RUSTLINGS {
|
||||||
check_cargo_toml(
|
check_cargo_toml(
|
||||||
|
|
Loading…
Reference in a new issue