Run clippy and use every fix (except return)

This commit is contained in:
Fabian Schmidt 2024-09-16 12:42:55 +02:00
parent bf5c537b3f
commit 1c00bf3984
6 changed files with 8 additions and 14 deletions

View File

@ -1,20 +1,14 @@
fn main() {
let result: i32 = (0..1000)
.into_iter()
.filter(|x| x % 3 == 0 || x % 5 == 0)
.sum();
let result: i32 = (0..1000).filter(|x| x % 3 == 0 || x % 5 == 0).sum();
println!("Result: {}", result);
println!("Result: {result}");
}
#[cfg(test)]
mod tests {
#[test]
fn it_works() {
let result: i32 = (0..10)
.into_iter()
.filter(|x| x % 3 == 0 || x % 5 == 0)
.sum();
let result: i32 = (0..10).filter(|x| x % 3 == 0 || x % 5 == 0).sum();
assert_eq!(result, 23);
}
}

View File

@ -1,6 +1,6 @@
fn main() {
let result = fibonacci_even_sum(4_000_000);
println!("Result: {}", result);
println!("Result: {result}");
}
fn fibonacci_even_sum(limit: i64) -> i64 {

View File

@ -1,6 +1,6 @@
fn main() {
let result = find_largest_palindrome(3);
println!("Result: {}", result);
println!("Result: {result}");
}
fn find_largest_palindrome(digits: u32) -> i64 {

View File

@ -1,6 +1,6 @@
fn main() {
let result = square_of_sum(100) - sum_of_squares(100);
println!("Result: {}", result);
println!("Result: {result}");
}
fn square_of_sum(range: i64) -> i64 {

View File

@ -1,6 +1,6 @@
fn main() {
let result = smallest_multiple(20);
println!("Result: {}", result);
println!("Result: {result}");
}
fn smallest_multiple(number: i64) -> i64 {

View File

@ -2,7 +2,7 @@ const NUMBER: &str = "731671765313306249192251196744265747423553491949349698352
fn main() {
let result = adjacent_product(NUMBER, 13);
println!("Result: {}", result);
println!("Result: {result}");
}
fn adjacent_product(number: &str, window: usize) -> i64 {