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
60 changes: 0 additions & 60 deletions .cargo/config.toml

This file was deleted.

13 changes: 12 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,23 @@ 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:
test:
runs-on: ubuntu-latest
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: ""
# Simpler to install Lean than to use lean-action for only this purpose.
- name: Install Lean
run: |
Expand All @@ -27,7 +38,7 @@ jobs:
- name: Check Rustfmt code style
uses: actions-rust-lang/rustfmt@v1
- name: Check clippy warnings
run: cargo xclippy
run: cargo clippy --workspace --all-targets --all-features
- name: Check *everything* compiles
run: cargo check --workspace --all-targets --all-features
- name: Run workspace tests
Expand Down
58 changes: 58 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,61 @@ license = "MIT OR Apache-2.0"
[workspace.dependencies]
num-bigint = "0.4.6"

[workspace.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"

[workspace.lints.clippy]
all = { level = "warn", priority = -1 }
# Casts
#cast_lossless = "warn" # TODO: Fix or remove. Causes issues with Aiur macros
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"

[package]
name = "lean-ffi"
version.workspace = true
Expand All @@ -29,6 +84,9 @@ num-bigint.workspace = true
bindgen = "0.72"
cc = "1"

[lints]
workspace = true

[profile.dev]
panic = "abort"

Expand Down
5 changes: 4 additions & 1 deletion bignat/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,7 @@ edition.workspace = true
license.workspace = true

[dependencies]
num-bigint.workspace = true
num-bigint.workspace = true

[lints]
workspace = true
8 changes: 5 additions & 3 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,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 @@ -127,12 +127,14 @@
};

checks = {
# Lint the Rust workspace; warnings are errors.
# Lint the Rust workspace; the lint set lives in Cargo.toml and
# CARGO_BUILD_WARNINGS promotes local-package warnings to errors.
clippy = craneLib.cargoClippy (
craneArgs
// {
inherit cargoArtifacts;
cargoClippyExtraArgs = "--workspace --all-targets --all-features -- -D warnings";
CARGO_BUILD_WARNINGS = "deny";
cargoClippyExtraArgs = "--workspace --all-targets --all-features";
}
);
# Build and run the Lean FFI test suite as a flake check.
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"