File tree 3 files changed +24
-5
lines changed
exercises/practice/perfect-numbers/.meta
3 files changed +24
-5
lines changed Original file line number Diff line number Diff line change @@ -123,6 +123,9 @@ jobs:
123
123
run : ./_test/check_exercises.sh
124
124
continue-on-error : ${{ matrix.rust == 'beta' && matrix.deny_warnings == '1' }}
125
125
126
+ - name : Cargo clean (to prevent previous compilation from unintentionally interfering with later ones)
127
+ run : ./_test/cargo_clean_all.sh
128
+
126
129
- name : Ensure stubs compile
127
130
env :
128
131
DENYWARNINGS : ${{ matrix.deny_warnings }}
Original file line number Diff line number Diff line change
1
+ #! /bin/sh
2
+
3
+ status=0
4
+ repo=" $( cd " $( dirname " $0 " ) /.." && pwd) "
5
+
6
+ for ex in " $repo " /exercises/* /* /; do
7
+ name=$( grep ' ^name =' " $ex /Cargo.toml" | cut -d\" -f2)
8
+ if [ -z " $name " ]; then
9
+ echo " don't know name of $ex "
10
+ status=1
11
+ continue
12
+ fi
13
+ cargo clean --manifest-path " $ex /Cargo.toml" --package " $name "
14
+ done
15
+
16
+ exit $status
Original file line number Diff line number Diff line change @@ -3,11 +3,11 @@ pub fn classify(num: u64) -> Option<Classification> {
3
3
return None ;
4
4
}
5
5
let sum: u64 = ( 1 ..num) . filter ( |i| num % i == 0 ) . sum ( ) ;
6
- match sum. cmp ( & num) {
7
- std:: cmp:: Ordering :: Equal => Some ( Classification :: Perfect ) ,
8
- std:: cmp:: Ordering :: Less => Some ( Classification :: Deficient ) ,
9
- std:: cmp:: Ordering :: Greater => Some ( Classification :: Abundant ) ,
10
- }
6
+ Some ( match sum. cmp ( & num) {
7
+ std:: cmp:: Ordering :: Equal => Classification :: Perfect ,
8
+ std:: cmp:: Ordering :: Less => Classification :: Deficient ,
9
+ std:: cmp:: Ordering :: Greater => Classification :: Abundant ,
10
+ } )
11
11
}
12
12
13
13
#[ derive( Debug , PartialEq , Eq ) ]
You can’t perform that action at this time.
0 commit comments