From 8ea1b17fd9505da92a7233d8bfd6d5f1c3d9a93e Mon Sep 17 00:00:00 2001 From: olivia Date: Mon, 14 May 2018 19:13:13 +0200 Subject: [PATCH] format --- src/main.rs | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/src/main.rs b/src/main.rs index c3ca53cd..3adc6bd2 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,11 +1,12 @@ -#[macro_use] extern crate quicli; +#[macro_use] +extern crate quicli; extern crate ansi_term; +use ansi_term::Colour::{Green, Red, Yellow}; use quicli::prelude::*; -use ansi_term::Colour::{Red, Yellow, Green}; macro_rules! verify { - ( $str:expr, $left:expr, $right:expr ) => { + ($left:expr, $right:expr, $str:expr) => { if ($left == $right) { println!("{} {}", Green.bold().paint("PASS"), $str); } else { @@ -13,11 +14,11 @@ macro_rules! verify { println!("\tYou submitted {}, but that's not correct!", $left); println!("\tPlease correct your code to make this test pass!"); } - } + }; } macro_rules! verify_easy { - ( $str:expr, $left:expr, $right:expr ) => { + ($str:expr, $left:expr, $right:expr) => { if ($left == $right) { println!("{} {}", Green.bold().paint("PASS"), $str); } else { @@ -26,7 +27,7 @@ macro_rules! verify_easy { println!("\tGot: {}", $left); println!("\tPlease correct your code to make this test pass!"); } - } + }; } mod about_variables; @@ -36,11 +37,9 @@ struct Cli { exercise: Option, } -main!(|args: Cli| { - if let Some(e) = args.exercise { - println!("selected {}", e); - } else { - println!("Welcome to {}", Yellow.paint("rustlings")); - verify!("One equals one", 1, 2); - } +main!(|args: Cli| if let Some(e) = args.exercise { + println!("selected {}", e); +} else { + println!("Welcome to {}", Yellow.paint("rustlings")); + verify!(2, 1, "One equals one"); });