Fix clippy issue & add fmt check

This commit is contained in:
Luke Street 2023-08-04 10:46:02 -04:00
parent b9fd6e077a
commit 2ccb5f7b36
2 changed files with 21 additions and 5 deletions

View File

@ -23,11 +23,27 @@ jobs:
- name: Setup Rust toolchain - name: Setup Rust toolchain
uses: dtolnay/rust-toolchain@stable uses: dtolnay/rust-toolchain@stable
with: with:
components: rustfmt, clippy components: clippy
- name: Cargo check - name: Cargo check
run: cargo check --all-features run: cargo check --all-features --all-targets
- name: Cargo clippy - name: Cargo clippy
run: cargo clippy --all-features run: cargo clippy --all-features --all-targets
fmt:
name: Format
runs-on: ubuntu-latest
env:
RUSTFLAGS: -D warnings
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Rust toolchain
# We use nightly options in rustfmt.toml
uses: dtolnay/rust-toolchain@nightly
with:
components: rustfmt
- name: Cargo fmt
run: cargo fmt --all --check
deny: deny:
name: Deny name: Deny
@ -72,7 +88,7 @@ jobs:
- platform: ubuntu-latest - platform: ubuntu-latest
target: i686-unknown-linux-musl target: i686-unknown-linux-musl
name: linux-x86 name: linux-x86
build: zigbuild build: zigbuild
- platform: ubuntu-latest - platform: ubuntu-latest
target: aarch64-unknown-linux-musl target: aarch64-unknown-linux-musl
name: linux-aarch64 name: linux-aarch64

View File

@ -48,7 +48,7 @@ impl ToString for LogLevel {
impl FromArgValue for LogLevel { impl FromArgValue for LogLevel {
fn from_arg_value(value: &OsStr) -> Result<Self, String> { fn from_arg_value(value: &OsStr) -> Result<Self, String> {
String::from_arg_value(value) String::from_arg_value(value)
.and_then(|s| Self::from_str(&s).map_err(|_| format!("Invalid log level"))) .and_then(|s| Self::from_str(&s).map_err(|_| "Invalid log level".to_string()))
} }
} }