Skip to content

Commit e27c799

Browse files
committed
perfect-numbers: extract Some
(need to make any arbitrary change so that this exercise is tested in PR)
1 parent c9dc097 commit e27c799

File tree

1 file changed

+5
-5
lines changed
  • exercises/practice/perfect-numbers/.meta

1 file changed

+5
-5
lines changed

exercises/practice/perfect-numbers/.meta/example.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ pub fn classify(num: u64) -> Option<Classification> {
33
return None;
44
}
55
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+
})
1111
}
1212

1313
#[derive(Debug, PartialEq, Eq)]

0 commit comments

Comments
 (0)