File tree Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change 2
2
name = " gcd"
3
3
version = " 0.1.0"
4
4
authors = [
" You <[email protected] >" ]
5
+ edition = " 2018"
5
6
6
7
[dependencies ]
Original file line number Diff line number Diff line change
1
+ #![ warn( rust_2018_idioms) ]
2
+ #![ allow( elided_lifetimes_in_paths) ]
3
+
1
4
fn gcd ( mut n : u64 , mut m : u64 ) -> u64 {
2
5
assert ! ( n != 0 && m != 0 ) ;
3
6
while m != 0 {
@@ -20,19 +23,19 @@ fn test_gcd() {
20
23
3 * 11 ) ;
21
24
}
22
25
23
- use std:: io:: Write ;
24
26
use std:: str:: FromStr ;
27
+ use std:: env;
25
28
26
29
fn main ( ) {
27
30
let mut numbers = Vec :: new ( ) ;
28
31
29
- for arg in std :: env:: args ( ) . skip ( 1 ) {
32
+ for arg in env:: args ( ) . skip ( 1 ) {
30
33
numbers. push ( u64:: from_str ( & arg)
31
34
. expect ( "error parsing argument" ) ) ;
32
35
}
33
36
34
37
if numbers. len ( ) == 0 {
35
- writeln ! ( std :: io :: stderr ( ) , "Usage: gcd NUMBER ..." ) . unwrap ( ) ;
38
+ eprintln ! ( "Usage: gcd NUMBER ..." ) ;
36
39
std:: process:: exit ( 1 ) ;
37
40
}
38
41
You can’t perform that action at this time.
0 commit comments