summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Pashev <pashev.igor@gmail.com>2020-04-28 13:52:19 +0200
committerIgor Pashev <pashev.igor@gmail.com>2020-04-28 13:52:19 +0200
commit7e77b68f6879917a27a0fa3426b9ceef242a9879 (patch)
tree55076c95968ee3da80243653d93089cbe17b63f1
parentd1b1dd013d5f50bcb903a97abe8d1700e6868170 (diff)
downloadgcd-7e77b68f6879917a27a0fa3426b9ceef242a9879.tar.gz
Reformat with rustfmt
-rw-r--r--gcd.rs28
1 files 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);
}
-