summaryrefslogtreecommitdiff
path: root/src/exercise.rs
diff options
context:
space:
mode:
authorMatt Lebl <lebl.matt@gmail.com>2021-03-19 02:16:07 -0700
committerMatt Lebl <lebl.matt@gmail.com>2021-03-19 02:16:07 -0700
commit8d62a9963708dbecd9312e8bcc4b47049c72d155 (patch)
tree3c5b973e1f1250624b709544e0d60bd607bf87a1 /src/exercise.rs
parent0d894e6ff739943901e1ae8c904582e5c2f843bd (diff)
feat: Replace emojis when NO_EMOJI env variable present
Diffstat (limited to 'src/exercise.rs')
-rw-r--r--src/exercise.rs7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/exercise.rs b/src/exercise.rs
index 18e8d5a..2c5d835 100644
--- a/src/exercise.rs
+++ b/src/exercise.rs
@@ -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