From 7e77b68f6879917a27a0fa3426b9ceef242a9879 Mon Sep 17 00:00:00 2001 From: Igor Pashev Date: Tue, 28 Apr 2020 13:52:19 +0200 Subject: Reformat with rustfmt --- gcd.rs | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/gcd.rs b/gcd.rs index a07377b..95cc865 100644 --- a/gcd.rs +++ b/gcd.rs @@ -1,24 +1,20 @@ use std::env; -fn gcd2(mut a: u64, mut b: u64) -> u64 -{ - while b != 0 { - let c = b; - b = a % b; - a = c; - } +fn gcd2(mut a: u64, mut b: u64) -> u64 { + while b != 0 { + let c = b; + b = a % b; + a = c; + } - a + a } +fn main() { + // XXX skip(1) to skip program name: + let nums = env::args().skip(1).map(|s| s.parse().unwrap()); -fn main () -{ - // XXX skip(1) to skip program name: - let nums = env::args().skip(1).map(|s| s.parse().unwrap()); + let gcd = nums.fold(0, gcd2); - let gcd = nums.fold(0, gcd2); - - println!("{}", gcd); + println!("{}", gcd); } - -- cgit v1.2.3