From 98f678e608d65862e00e817614edfb77d1035750 Mon Sep 17 00:00:00 2001 From: Joshua Nelson Date: Sun, 13 Sep 2020 11:22:29 -0400 Subject: [PATCH] Run clippy on non-default features, too This fixes the CI failure in https://github.com/jyn514/saltwater/pull/515#issuecomment-691684770 and is generally good practice. --- src/main.rs | 2 +- tests/pre-commit.sh | 2 +- tests/runner-tests/hello_world.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main.rs b/src/main.rs index d5ec1253..bfbe1f35 100644 --- a/src/main.rs +++ b/src/main.rs @@ -428,7 +428,7 @@ fn error(msg: T, location: Location, file_db: &Files, colo let err = { use rand::Rng; - let name = std::env::var("USER").unwrap_or("programmer".into()); + let name = std::env::var("USER").unwrap_or_else(|_| "programmer".into()); shut_up = format!("Shut up, {}. I don't ever want to hear that kind of obvious garbage and idiocy from a developer again", name); let msgs = [ "you can't write code", diff --git a/tests/pre-commit.sh b/tests/pre-commit.sh index d31dd0fd..b1ad231d 100755 --- a/tests/pre-commit.sh +++ b/tests/pre-commit.sh @@ -1,5 +1,5 @@ #!/bin/sh set -ev cargo fmt --all -- --check -cargo clippy --all -- -D clippy::all -D unused-imports +cargo clippy --all --all-features -- -D clippy::all -D unused-imports cargo test --all --all-features diff --git a/tests/runner-tests/hello_world.c b/tests/runner-tests/hello_world.c index 5bcf3424..4d5bc093 100644 --- a/tests/runner-tests/hello_world.c +++ b/tests/runner-tests/hello_world.c @@ -1,4 +1,4 @@ -#include +int puts(const char *); int main() { puts("Hello, world!");