Skip to content

Commit abf1751

Browse files
committed
clippy-ify
1 parent 9144c81 commit abf1751

File tree

3 files changed

+21
-21
lines changed

3 files changed

+21
-21
lines changed

src/main.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,33 +36,33 @@ fn main() {
3636
let ts = ThemeSet::load_defaults();
3737

3838
if None == matches.subcommand_name() {
39-
println!("");
39+
println!();
4040
println!(r#" welcome to... "#);
4141
println!(r#" _ _ _ "#);
4242
println!(r#" _ __ _ _ ___| |_| (_)_ __ __ _ ___ "#);
4343
println!(r#" | '__| | | / __| __| | | '_ \ / _` / __| "#);
4444
println!(r#" | | | |_| \__ \ |_| | | | | | (_| \__ \ "#);
4545
println!(r#" |_| \__,_|___/\__|_|_|_| |_|\__, |___/ "#);
4646
println!(r#" |___/ "#);
47-
println!("");
47+
println!();
4848
}
4949

5050
if let Some(matches) = matches.subcommand_matches("run") {
5151
run(matches.clone()).unwrap();
5252
}
5353

54-
if let Some(_) = matches.subcommand_matches("verify") {
54+
if matches.subcommand_matches("verify").is_some() {
5555
match verify() {
5656
Ok(_) => {}
5757
Err(_) => std::process::exit(1),
5858
}
5959
}
6060

61-
if let Some(_) = matches.subcommand_matches("watch") {
61+
if matches.subcommand_matches("watch").is_some() {
6262
watch().unwrap();
6363
}
6464

65-
if let None = matches.subcommand_name() {
65+
if matches.subcommand_name().is_none() {
6666
let mut highlighter =
6767
HighlightFile::new("default_out.md", &ss, &ts.themes["base16-eighties.dark"]).unwrap();
6868
for maybe_line in highlighter.reader.lines() {

src/run.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,17 @@ pub fn run(matches: clap::ArgMatches) -> Result<(), ()> {
3030
}
3131

3232
pub fn compile_and_run(filename: &str) -> Result<(), ()> {
33-
let bar = ProgressBar::new_spinner();
34-
bar.set_message(format!("Compiling {}...", filename).as_str());
35-
bar.enable_steady_tick(100);
33+
let progress_bar = ProgressBar::new_spinner();
34+
progress_bar.set_message(format!("Compiling {}...", filename).as_str());
35+
progress_bar.enable_steady_tick(100);
3636
let compilecmd = Command::new("rustc")
3737
.args(&[filename, "-o", "temp", "--color", "always"])
3838
.output()
3939
.expect("fail");
40-
bar.set_message(format!("Running {}...", filename).as_str());
40+
progress_bar.set_message(format!("Running {}...", filename).as_str());
4141
if compilecmd.status.success() {
4242
let runcmd = Command::new("./temp").output().expect("fail");
43-
bar.finish_and_clear();
43+
progress_bar.finish_and_clear();
4444

4545
if runcmd.status.success() {
4646
println!("{}", String::from_utf8_lossy(&runcmd.stdout));
@@ -58,7 +58,7 @@ pub fn compile_and_run(filename: &str) -> Result<(), ()> {
5858
Err(())
5959
}
6060
} else {
61-
bar.finish_and_clear();
61+
progress_bar.finish_and_clear();
6262
let formatstr = format!(
6363
"{} Compilation of {} failed! Compiler error message:\n",
6464
Emoji("⚠️ ", "!"),

src/verify.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@ pub fn verify() -> Result<(), ()> {
1919
}
2020

2121
fn compile_only(filename: &str) -> Result<(), ()> {
22-
let bar = ProgressBar::new_spinner();
23-
bar.set_message(format!("Compiling {}...", filename).as_str());
24-
bar.enable_steady_tick(100);
22+
let progress_bar = ProgressBar::new_spinner();
23+
progress_bar.set_message(format!("Compiling {}...", filename).as_str());
24+
progress_bar.enable_steady_tick(100);
2525
let compilecmd = Command::new("rustc")
2626
.args(&[filename, "-o", "temp", "--color", "always"])
2727
.output()
2828
.expect("fail");
29-
bar.finish_and_clear();
29+
progress_bar.finish_and_clear();
3030
if compilecmd.status.success() {
3131
let formatstr = format!(
3232
"{} Successfully compiled {}!",
@@ -50,17 +50,17 @@ fn compile_only(filename: &str) -> Result<(), ()> {
5050
}
5151

5252
pub fn test(filename: &str) -> Result<(), ()> {
53-
let bar = ProgressBar::new_spinner();
54-
bar.set_message(format!("Testing {}...", filename).as_str());
55-
bar.enable_steady_tick(100);
53+
let progress_bar = ProgressBar::new_spinner();
54+
progress_bar.set_message(format!("Testing {}...", filename).as_str());
55+
progress_bar.enable_steady_tick(100);
5656
let testcmd = Command::new("rustc")
5757
.args(&["--test", filename, "-o", "temp", "--color", "always"])
5858
.output()
5959
.expect("fail");
6060
if testcmd.status.success() {
61-
bar.set_message(format!("Running {}...", filename).as_str());
61+
progress_bar.set_message(format!("Running {}...", filename).as_str());
6262
let runcmd = Command::new("./temp").output().expect("fail");
63-
bar.finish_and_clear();
63+
progress_bar.finish_and_clear();
6464

6565
if runcmd.status.success() {
6666
let formatstr = format!("{} Successfully tested {}!", Emoji("✅", "✓"), filename);
@@ -79,7 +79,7 @@ pub fn test(filename: &str) -> Result<(), ()> {
7979
Err(())
8080
}
8181
} else {
82-
bar.finish_and_clear();
82+
progress_bar.finish_and_clear();
8383
let formatstr = format!(
8484
"{} Compiling of {} failed! Please try again. Here's the output:",
8585
Emoji("⚠️ ", "!"),

0 commit comments

Comments
 (0)