Skip to content

Commit

Permalink
Correct the counting of the number of arguments
Browse files Browse the repository at this point in the history
Clippy rightfully complains, that a `.skip(0)` does not make sense and
likely should have been a `.skip(1)`. This commit changes it, but it is
strange, that both versions work and pass the test suite. Therefore this
is a separate commit, so it could be reverted if necessary.
  • Loading branch information
jfrimmel committed Sep 18, 2024
1 parent 40b895b commit 87fe464
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ fn display_stack_trace(msg: &str, stack: &valgrind::xml::Stack) {
fn main() {
panic::replace_hook();

let number_of_arguments = || env::args_os().skip(0).count();
let number_of_arguments = || env::args_os().skip(1).count();
let help_requested = || env::args_os().any(|arg| arg == "--help" || arg == "-h");
let is_cargo_subcommand = || env::args_os().nth(1).map_or(false, |arg| arg == "valgrind");
if number_of_arguments() == 0 || help_requested() {
Expand Down

0 comments on commit 87fe464

Please sign in to comment.