mirror of
https://github.com/notohh/rustlings.git
synced 2024-10-31 01:09:11 -04:00
style: formatted files with rustfmt
This commit is contained in:
parent
c0e3daacaf
commit
bd48544e25
3 changed files with 7 additions and 16 deletions
|
@ -1,6 +1,6 @@
|
||||||
use std::env;
|
|
||||||
use regex::Regex;
|
use regex::Regex;
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
|
use std::env;
|
||||||
use std::fmt::{self, Display, Formatter};
|
use std::fmt::{self, Display, Formatter};
|
||||||
use std::fs::{self, remove_file, File};
|
use std::fs::{self, remove_file, File};
|
||||||
use std::io::Read;
|
use std::io::Read;
|
||||||
|
@ -132,8 +132,7 @@ path = "{}.rs""#,
|
||||||
} else {
|
} else {
|
||||||
"Failed to write 📎 Clippy 📎 Cargo.toml file."
|
"Failed to write 📎 Clippy 📎 Cargo.toml file."
|
||||||
};
|
};
|
||||||
fs::write(CLIPPY_CARGO_TOML_PATH, cargo_toml)
|
fs::write(CLIPPY_CARGO_TOML_PATH, cargo_toml).expect(cargo_toml_error_msg);
|
||||||
.expect(cargo_toml_error_msg);
|
|
||||||
// To support the ability to run the clipy exercises, build
|
// To support the ability to run the clipy exercises, build
|
||||||
// an executable, in addition to running clippy. With a
|
// an executable, in addition to running clippy. With a
|
||||||
// compilation failure, this would silently fail. But we expect
|
// compilation failure, this would silently fail. But we expect
|
||||||
|
|
16
src/ui.rs
16
src/ui.rs
|
@ -1,14 +1,10 @@
|
||||||
macro_rules! warn {
|
macro_rules! warn {
|
||||||
($fmt:literal, $ex:expr) => {{
|
($fmt:literal, $ex:expr) => {{
|
||||||
use std::env;
|
|
||||||
use console::{style, Emoji};
|
use console::{style, Emoji};
|
||||||
|
use std::env;
|
||||||
let formatstr = format!($fmt, $ex);
|
let formatstr = format!($fmt, $ex);
|
||||||
if env::var("NO_EMOJI").is_ok() {
|
if env::var("NO_EMOJI").is_ok() {
|
||||||
println!(
|
println!("{} {}", style("!").red(), style(formatstr).red());
|
||||||
"{} {}",
|
|
||||||
style("!").red(),
|
|
||||||
style(formatstr).red()
|
|
||||||
);
|
|
||||||
} else {
|
} else {
|
||||||
println!(
|
println!(
|
||||||
"{} {}",
|
"{} {}",
|
||||||
|
@ -21,15 +17,11 @@ macro_rules! warn {
|
||||||
|
|
||||||
macro_rules! success {
|
macro_rules! success {
|
||||||
($fmt:literal, $ex:expr) => {{
|
($fmt:literal, $ex:expr) => {{
|
||||||
use std::env;
|
|
||||||
use console::{style, Emoji};
|
use console::{style, Emoji};
|
||||||
|
use std::env;
|
||||||
let formatstr = format!($fmt, $ex);
|
let formatstr = format!($fmt, $ex);
|
||||||
if env::var("NO_EMOJI").is_ok() {
|
if env::var("NO_EMOJI").is_ok() {
|
||||||
println!(
|
println!("{} {}", style("✓").green(), style(formatstr).green());
|
||||||
"{} {}",
|
|
||||||
style("✓").green(),
|
|
||||||
style(formatstr).green()
|
|
||||||
);
|
|
||||||
} else {
|
} else {
|
||||||
println!(
|
println!(
|
||||||
"{} {}",
|
"{} {}",
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
use std::env;
|
|
||||||
use crate::exercise::{CompiledExercise, Exercise, Mode, State};
|
use crate::exercise::{CompiledExercise, Exercise, Mode, State};
|
||||||
use console::style;
|
use console::style;
|
||||||
use indicatif::ProgressBar;
|
use indicatif::ProgressBar;
|
||||||
|
use std::env;
|
||||||
|
|
||||||
// Verify that the provided container of Exercise objects
|
// Verify that the provided container of Exercise objects
|
||||||
// can be compiled and run without any failures.
|
// can be compiled and run without any failures.
|
||||||
|
|
Loading…
Reference in a new issue