I'm running Clippy with the following command:
cargo clippy --fix -- -F warnings
It runs, returns the output below, and terminates with the exit code 0:
warning: writing `&Vec` instead of `&[_]` involves a new object where a slice will do
--> project-euler/multiples_of_3_or_5/src/main.rs:46:37
|
46 | pub fn sum_multiples(multiplicands: &Vec<u32>, maximum_possible_multiple: u32) -> u32 {
| ^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg
= note: `-F clippy::ptr-arg` implied by `-F warnings`
help: change this to
|
46 ~ pub fn sum_multiples(multiplicands: &[u32], maximum_possible_multiple: u32) -> u32 {
47 | let possible_multiples: std::ops::Range<u32> = 1..maximum_possible_multiple;
...
50 | .filter(|possible_multiple| {
51 ~ multiplicands.to_owned()
|
warning: called `is_some()` after searching an `Iterator` with `find`
--> project-euler/multiples_of_3_or_5/src/main.rs:54:18
|
54 | .find(|multiplicand| possible_multiple.is_multiple_of(*multiplicand))
| __________________^
55 | | .is_some()
| |__________________________^ help: use `any()` instead: `any(|multiplicand| possible_multiple.is_multiple_of(multiplicand))`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#search_is_some
= note: `-F clippy::search-is-some` implied by `-F warnings`
warning: `multiples_of_3_or_5` (bin "multiples_of_3_or_5") generated 2 warnings
warning: `multiples_of_3_or_5` (bin "multiples_of_3_or_5" test) generated 2 warnings (2 duplicates)
Finished dev [unoptimized + debuginfo] target(s) in 1.49s
But whenever i repeat the same command, but without the --fix
flag, works as expected, the output is similar to the one above but slightly different, it terminates with the exit code 101:
error: writing `&Vec` instead of `&[_]` involves a new object where a slice will do
--> project-euler/multiples_of_3_or_5/src/main.rs:46:37
|
46 | pub fn sum_multiples(multiplicands: &Vec<u32>, maximum_possible_multiple: u32) -> u32 {
| ^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg
= note: `-F clippy::ptr-arg` implied by `-F warnings`
help: change this to
|
46 ~ pub fn sum_multiples(multiplicands: &[u32], maximum_possible_multiple: u32) -> u32 {
47 | let possible_multiples: std::ops::Range<u32> = 1..maximum_possible_multiple;
...
50 | .filter(|possible_multiple| {
51 ~ multiplicands.to_owned()
|
error: called `is_some()` after searching an `Iterator` with `find`
--> project-euler/multiples_of_3_or_5/src/main.rs:54:18
|
54 | .find(|multiplicand| possible_multiple.is_multiple_of(*multiplicand))
| __________________^
55 | | .is_some()
| |__________________________^ help: use `any()` instead: `any(|multiplicand| possible_multiple.is_multiple_of(multiplicand))`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#search_is_some
= note: `-F clippy::search-is-some` implied by `-F warnings`
error: could not compile `multiples_of_3_or_5` (bin "multiples_of_3_or_5") due to 2 previous errors
warning: build failed, waiting for other jobs to finish...
Cross-posted at: rust - Clippy returning incorrect exit code when automatically applying lint suggestions - Stack Overflow