Run clippy and use every fix (except return)
This commit is contained in:
parent
bf5c537b3f
commit
1c00bf3984
@ -1,20 +1,14 @@
|
|||||||
fn main() {
|
fn main() {
|
||||||
let result: i32 = (0..1000)
|
let result: i32 = (0..1000).filter(|x| x % 3 == 0 || x % 5 == 0).sum();
|
||||||
.into_iter()
|
|
||||||
.filter(|x| x % 3 == 0 || x % 5 == 0)
|
|
||||||
.sum();
|
|
||||||
|
|
||||||
println!("Result: {}", result);
|
println!("Result: {result}");
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
#[test]
|
#[test]
|
||||||
fn it_works() {
|
fn it_works() {
|
||||||
let result: i32 = (0..10)
|
let result: i32 = (0..10).filter(|x| x % 3 == 0 || x % 5 == 0).sum();
|
||||||
.into_iter()
|
|
||||||
.filter(|x| x % 3 == 0 || x % 5 == 0)
|
|
||||||
.sum();
|
|
||||||
assert_eq!(result, 23);
|
assert_eq!(result, 23);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
fn main() {
|
fn main() {
|
||||||
let result = fibonacci_even_sum(4_000_000);
|
let result = fibonacci_even_sum(4_000_000);
|
||||||
println!("Result: {}", result);
|
println!("Result: {result}");
|
||||||
}
|
}
|
||||||
|
|
||||||
fn fibonacci_even_sum(limit: i64) -> i64 {
|
fn fibonacci_even_sum(limit: i64) -> i64 {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
fn main() {
|
fn main() {
|
||||||
let result = find_largest_palindrome(3);
|
let result = find_largest_palindrome(3);
|
||||||
println!("Result: {}", result);
|
println!("Result: {result}");
|
||||||
}
|
}
|
||||||
|
|
||||||
fn find_largest_palindrome(digits: u32) -> i64 {
|
fn find_largest_palindrome(digits: u32) -> i64 {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
fn main() {
|
fn main() {
|
||||||
let result = square_of_sum(100) - sum_of_squares(100);
|
let result = square_of_sum(100) - sum_of_squares(100);
|
||||||
println!("Result: {}", result);
|
println!("Result: {result}");
|
||||||
}
|
}
|
||||||
|
|
||||||
fn square_of_sum(range: i64) -> i64 {
|
fn square_of_sum(range: i64) -> i64 {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
fn main() {
|
fn main() {
|
||||||
let result = smallest_multiple(20);
|
let result = smallest_multiple(20);
|
||||||
println!("Result: {}", result);
|
println!("Result: {result}");
|
||||||
}
|
}
|
||||||
|
|
||||||
fn smallest_multiple(number: i64) -> i64 {
|
fn smallest_multiple(number: i64) -> i64 {
|
||||||
|
@ -2,7 +2,7 @@ const NUMBER: &str = "731671765313306249192251196744265747423553491949349698352
|
|||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let result = adjacent_product(NUMBER, 13);
|
let result = adjacent_product(NUMBER, 13);
|
||||||
println!("Result: {}", result);
|
println!("Result: {result}");
|
||||||
}
|
}
|
||||||
|
|
||||||
fn adjacent_product(number: &str, window: usize) -> i64 {
|
fn adjacent_product(number: &str, window: usize) -> i64 {
|
||||||
|
Loading…
Reference in New Issue
Block a user