From 8d62a9963708dbecd9312e8bcc4b47049c72d155 Mon Sep 17 00:00:00 2001 From: Matt Lebl Date: Fri, 19 Mar 2021 02:16:07 -0700 Subject: feat: Replace emojis when NO_EMOJI env variable present --- src/exercise.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/exercise.rs') 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 -- cgit v1.2.3