1
0
Fork 0
mirror of https://github.com/notohh/rustlings.git synced 2025-07-26 07:10:05 -04:00

feat: Replace emojis when NO_EMOJI env variable present

This commit is contained in:
Matt Lebl 2021-03-19 02:16:07 -07:00
commit 8d62a99637
3 changed files with 53 additions and 13 deletions

View file

@ -1,3 +1,4 @@
use std::env;
use regex::Regex;
use serde::Deserialize;
use std::fmt::{self, Display, Formatter};
@ -126,8 +127,12 @@ name = "{}"
path = "{}.rs""#,
self.name, self.name, self.name
);
let cargo_toml_error_msg = match env::var("NO_EMOJI").is_ok() {
true => "Failed to write Clippy Cargo.toml file.",
false => "Failed to write 📎 Clippy 📎 Cargo.toml file."
};
fs::write(CLIPPY_CARGO_TOML_PATH, cargo_toml)
.expect("Failed to write 📎 Clippy 📎 Cargo.toml file.");
.expect(cargo_toml_error_msg);
// To support the ability to run the clipy exercises, build
// an executable, in addition to running clippy. With a
// compilation failure, this would silently fail. But we expect