diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0bd09e2..48aa1f3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 @@ -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: diff --git a/flake.nix b/flake.nix index 67f3a2c..ed1c59f 100644 --- a/flake.nix +++ b/flake.nix @@ -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 @@ -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) diff --git a/rust-toolchain.toml b/rust-toolchain.toml index a5b578d..23de054 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -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" diff --git a/rust/Cargo.lock b/rust/Cargo.lock index 3af6403..f22a78d 100644 --- a/rust/Cargo.lock +++ b/rust/Cargo.lock @@ -26,7 +26,7 @@ checksum = "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53" [[package]] name = "bignat" version = "0.1.0" -source = "git+https://github.com/argumentcomputer/lean-ffi?rev=2a9c91eba44ea791978a086a6a19b3a922edfee5#2a9c91eba44ea791978a086a6a19b3a922edfee5" +source = "git+https://github.com/argumentcomputer/lean-ffi?rev=93c7e52952ae94546be08313f4ff3922984c84d5#93c7e52952ae94546be08313f4ff3922984c84d5" dependencies = [ "num-bigint", ] @@ -159,7 +159,7 @@ dependencies = [ [[package]] name = "lean-ffi" version = "0.1.0" -source = "git+https://github.com/argumentcomputer/lean-ffi?rev=2a9c91eba44ea791978a086a6a19b3a922edfee5#2a9c91eba44ea791978a086a6a19b3a922edfee5" +source = "git+https://github.com/argumentcomputer/lean-ffi?rev=93c7e52952ae94546be08313f4ff3922984c84d5#93c7e52952ae94546be08313f4ff3922984c84d5" dependencies = [ "bignat", "bindgen", diff --git a/rust/Cargo.toml b/rust/Cargo.toml index 777f0a4..3606212 100644 --- a/rust/Cargo.toml +++ b/rust/Cargo.toml @@ -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"