Skip to content

Commit

Permalink
chore(ci): better clippy lints, deny unwrap() outside of tests (#34)
Browse files Browse the repository at this point in the history
Signed-off-by: Dori Medini <[email protected]>
  • Loading branch information
dorimedini-starkware authored Apr 11, 2024
1 parent 0714dfb commit 50c1d13
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,4 @@ unused = "deny"

[workspace.lints.clippy]
as_conversions = "deny"
unwrap_used = "deny"
1 change: 1 addition & 0 deletions clippy.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
allow-unwrap-in-tests = true
3 changes: 2 additions & 1 deletion crates/committer_cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ fn main() {
);

// Business logic to be implemented here.
let output = std::fs::read(input_file_name).unwrap();
let output = std::fs::read(input_file_name)
.unwrap_or_else(|_| panic!("Failed to read input from file '{input_file_name:?}'"));

// Output to file.
std::fs::write(output_file_name, output).expect("Failed to write output");
Expand Down
3 changes: 1 addition & 2 deletions scripts/clippy.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#!/bin/bash

cargo clippy "$@" --all-targets --all-features -- -D warnings -D future-incompatible \
-D nonstandard-style -D rust-2018-idioms -D unused
cargo clippy "$@" --all-targets --all-features

0 comments on commit 50c1d13

Please sign in to comment.