Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

# Fail every cargo invocation on warnings from workspace-local packages
# (cargo's build.warnings, stable since 1.97). CI-only: local builds
# still just warn.
env:
CARGO_BUILD_WARNINGS: deny

jobs:
lean-test:
name: Lean Tests
Expand All @@ -28,6 +34,11 @@ jobs:
steps:
- uses: actions/checkout@v7
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
# Warnings are handled by CARGO_BUILD_WARNINGS above, which applies
# to local packages only. The action defaults to `-D warnings`,
# which also denies warnings from dependencies.
rustflags: ""
# Only restore the cache, since the `test` job will save the test binary to the cache first
- uses: actions/cache/restore@v6
with:
Expand Down
8 changes: 5 additions & 3 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
# Pins the Rust toolchain
rustToolchain = fenix.packages.${system}.fromToolchainFile {
file = ./rust-toolchain.toml;
sha256 = "sha256-sqSWJDUxc+zaz1nBWMAJKTAGBuGWP25GCftIOlCEAtA=";
sha256 = "sha256-P30Tm3O7vQAE725YtDCDHGjNrSsfZO4us11UwJGZSJo=";
};

# Rust package
Expand Down Expand Up @@ -164,12 +164,14 @@
};

checks = {
# Lint the Rust FFI crate; warnings are errors.
# Lint the Rust FFI crate; the lint set lives in rust/Cargo.toml and
# CARGO_BUILD_WARNINGS promotes local-package warnings to errors.
clippy = craneLib.cargoClippy (
craneArgs
// {
inherit cargoArtifacts;
cargoClippyExtraArgs = "--all-targets -- -D warnings";
CARGO_BUILD_WARNINGS = "deny";
cargoClippyExtraArgs = "--all-targets";
}
);
# Run the Lean test suite (exercises both the C and Rust backends)
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[toolchain]
# The default profile includes rustc, rust-std, cargo, rust-docs, rustfmt and clippy.
profile = "default"
channel = "1.92"
channel = "1.98"
4 changes: 2 additions & 2 deletions rust/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

56 changes: 55 additions & 1 deletion rust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,64 @@ crate-type = ["staticlib", "cdylib"]

[dependencies]
blake3 = "1.8.7"
lean-ffi = { git = "https://github.com/argumentcomputer/lean-ffi", rev = "2a9c91eba44ea791978a086a6a19b3a922edfee5" }
lean-ffi = { git = "https://github.com/argumentcomputer/lean-ffi", rev = "93c7e52952ae94546be08313f4ff3922984c84d5" }

[profile.dev]
panic = "abort"

[profile.release]
panic = "abort"

[lints.rust]
invalid_reference_casting = "warn"
nonstandard_style = { level = "warn", priority = -1 }
rust_2018_idioms = { level = "warn", priority = -1 }
trivial_numeric_casts = "warn"
unreachable_pub = "warn"
unused_lifetimes = "warn"
unused_qualifications = "warn"

[lints.clippy]
all = { level = "warn", priority = -1 }
# Casts
cast_possible_truncation = "warn"
cast_possible_wrap = "warn"
cast_precision_loss = "warn"
cast_sign_loss = "warn"
char_lit_as_u8 = "warn"
checked_conversions = "warn"
fn_to_numeric_cast = "warn"
fn_to_numeric_cast_with_truncation = "warn"
invalid_upcast_comparisons = "warn"
ptr_as_ptr = "warn"
unnecessary_cast = "warn"
# Everything else
dbg_macro = "warn"
derive_partial_eq_without_eq = "warn"
disallowed_methods = "warn"
enum_glob_use = "warn"
explicit_into_iter_loop = "warn"
fallible_impl_from = "warn"
filter_map_next = "warn"
flat_map_option = "warn"
implicit_clone = "warn"
inefficient_to_string = "warn"
large_stack_arrays = "warn"
large_types_passed_by_value = "warn"
macro_use_imports = "warn"
manual_assert = "warn"
manual_ok_or = "warn"
map_err_ignore = "warn"
map_flatten = "warn"
map_unwrap_or = "warn"
match_same_arms = "warn"
match_wild_err_arm = "warn"
needless_borrow = "warn"
needless_continue = "warn"
needless_for_each = "warn"
needless_pass_by_value = "warn"
option_option = "warn"
same_functions_in_if_condition = "warn"
trait_duplication_in_bounds = "warn"
unnecessary_wraps = "warn"
unnested_or_patterns = "warn"