Skip to content

Commit

Permalink
clippy: autofix some lint warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiaskrgr committed Jan 5, 2024
1 parent 85e21fa commit 2f4f630
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@ fn channel() -> String {

fn commit_hash() -> Option<String> {
Command::new("git")
.args(&["rev-parse", "--short", "HEAD"])
.args(["rev-parse", "--short", "HEAD"])
.output()
.ok()
.and_then(|r| String::from_utf8(r.stdout).ok())
}

fn commit_date() -> Option<String> {
Command::new("git")
.args(&["log", "-1", "--date=short", "--pretty=format:%cd"])
.args(["log", "-1", "--date=short", "--pretty=format:%cd"])
.output()
.ok()
.and_then(|r| String::from_utf8(r.stdout).ok())
Expand Down
2 changes: 1 addition & 1 deletion src/bin/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ fn print_version() {
fn determine_operation(matches: &Matches) -> Result<Operation, OperationError> {
if matches.opt_present("h") {
let topic = matches.opt_str("h");
if topic == None {
if topic.is_none() {
return Ok(Operation::Help(HelpOp::None));
} else if topic == Some("config".to_owned()) {
return Ok(Operation::Help(HelpOp::Config));
Expand Down
12 changes: 6 additions & 6 deletions src/format-diff/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -234,14 +234,14 @@ mod cmd_line_tests {
#[test]
fn default_options() {
let empty: Vec<String> = vec![];
let o = Opts::parse_from(&empty);
let o = Opts::parse_from(empty);
assert_eq!(DEFAULT_PATTERN, o.filter);
assert_eq!(0, o.skip_prefix);
}

#[test]
fn good_options() {
let o = Opts::parse_from(&["test", "-p", "10", "-f", r".*\.hs"]);
let o = Opts::parse_from(["test", "-p", "10", "-f", r".*\.hs"]);
assert_eq!(r".*\.hs", o.filter);
assert_eq!(10, o.skip_prefix);
}
Expand All @@ -250,7 +250,7 @@ mod cmd_line_tests {
fn unexpected_option() {
assert!(
Opts::command()
.try_get_matches_from(&["test", "unexpected"])
.try_get_matches_from(["test", "unexpected"])
.is_err()
);
}
Expand All @@ -259,7 +259,7 @@ mod cmd_line_tests {
fn unexpected_flag() {
assert!(
Opts::command()
.try_get_matches_from(&["test", "--flag"])
.try_get_matches_from(["test", "--flag"])
.is_err()
);
}
Expand All @@ -268,7 +268,7 @@ mod cmd_line_tests {
fn overridden_option() {
assert!(
Opts::command()
.try_get_matches_from(&["test", "-p", "10", "-p", "20"])
.try_get_matches_from(["test", "-p", "10", "-p", "20"])
.is_err()
);
}
Expand All @@ -277,7 +277,7 @@ mod cmd_line_tests {
fn negative_filter() {
assert!(
Opts::command()
.try_get_matches_from(&["test", "-p", "-1"])
.try_get_matches_from(["test", "-p", "-1"])
.is_err()
);
}
Expand Down

0 comments on commit 2f4f630

Please sign in to comment.