Skip to content
Open
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
78 changes: 9 additions & 69 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,28 @@
#
# NOTE: Only lints that the codebase currently passes are enabled.
# Additional lints can be enabled incrementally as the codebase is cleaned up.
# NOTE: for the `make lint` command to work well, this must contain the same list of lints as the xclippy-fix command below
# NOTE: the `xclippy` alias below is the single source of truth for the project
# clippy lints; the fix path (`make xclippy-fix`) derives them from here so the
# check and fix commands can never drift apart.
xclippy = [
"clippy", "--workspace", "--all-targets", "--all-features", "--",
"-Wclippy::all",
# Lints that currently pass in the codebase:
"-Wclippy::await_holding_lock",
"-Wclippy::char_lit_as_u8",
"-Wclippy::checked_conversions",
"-Wclippy::dbg_macro",
"-Wclippy::debug_assert_with_mut_call",
"-Wclippy::derive_partial_eq_without_eq",
"-Wclippy::disallowed_methods",
"-Wclippy::empty_enums",
"-Wclippy::exit",
"-Wclippy::expl_impl_clone_on_copy",
"-Wclippy::explicit_deref_methods",
"-Wclippy::filter_map_next",
"-Wclippy::flat_map_option",
"-Wclippy::float_cmp_const",
"-Wclippy::fn_params_excessive_bools",
"-Wclippy::if_let_mutex",
"-Wclippy::imprecise_flops",
"-Wclippy::inefficient_to_string",
Expand All @@ -42,6 +48,7 @@ xclippy = [
"-Wclippy::needless_borrow",
"-Wclippy::needless_collect",
"-Wclippy::needless_continue",
"-Wclippy::option_option",
"-Wclippy::path_buf_push_overwrite",
"-Wclippy::rc_mutex",
"-Wclippy::redundant_clone",
Expand All @@ -53,6 +60,7 @@ xclippy = [
"-Wclippy::string_add_assign",
"-Wclippy::todo",
"-Wclippy::trait_duplication_in_bounds",
"-Wclippy::unimplemented",
"-Wclippy::trivially_copy_pass_by_ref",
"-Wclippy::uninlined_format_args",
"-Wclippy::unnested_or_patterns",
Expand All @@ -66,14 +74,10 @@ xclippy = [
"-Wunused_lifetimes",
"-Wunused_qualifications",
# The following lints are disabled because they trigger warnings:
# -Wclippy::checked_conversions (12 warnings)
# -Wclippy::debug_assert_with_mut_call (3 warnings)
# -Wclippy::doc_markdown (1293 warnings)
# -Wclippy::enum_glob_use (17 warnings)
# -Wclippy::expl_impl_clone_on_copy (1 warning)
# -Wclippy::explicit_into_iter_loop (7 warnings)
# -Wclippy::fallible_impl_from (3 warnings)
# -Wclippy::fn_params_excessive_bools (1 warning)
# -Wclippy::from_iter_instead_of_collect (4 warnings)
# -Wclippy::implicit_clone (5 warnings)
# -Wclippy::map_err_ignore (78 warnings)
Expand All @@ -82,12 +86,10 @@ xclippy = [
# -Wclippy::match_wild_err_arm (6 warnings)
# -Wclippy::match_wildcard_for_single_variants (8 warnings)
# -Wclippy::needless_for_each (7 warnings)
# -Wclippy::option_option (6 warnings)
# -Wclippy::ptr_as_ptr (15 warnings)
# -Wclippy::semicolon_if_nothing_returned (97 warnings)
# -Wclippy::single_match_else (54 warnings)
# -Wclippy::string_lit_as_bytes (15 warnings)
# -Wclippy::unimplemented (1 warning)
# -Wclippy::unused_self (11 warnings)
# -Wclippy::cast_lossless (603 warnings)
# -Wclippy::manual_assert (17 warnings)
Expand All @@ -97,67 +99,5 @@ xclippy = [
# -Wunreachable_pub (545 warnings)
]

# Clippy fix with the same lints as xclippy
# NOTE: for the `make lint` command to work well, this must contain the same list of lints as the xclippy setting above
xclippy-fix = [
"clippy", "--fix", "--allow-staged", "--allow-dirty", "--workspace", "--all-targets", "--all-features", "--",
"-Wclippy::all",
"-Wclippy::await_holding_lock",
"-Wclippy::char_lit_as_u8",
"-Wclippy::dbg_macro",
"-Wclippy::derive_partial_eq_without_eq",
"-Wclippy::disallowed_methods",
"-Wclippy::empty_enums",
"-Wclippy::exit",
"-Wclippy::explicit_deref_methods",
"-Wclippy::filter_map_next",
"-Wclippy::flat_map_option",
"-Wclippy::float_cmp_const",
"-Wclippy::if_let_mutex",
"-Wclippy::imprecise_flops",
"-Wclippy::inefficient_to_string",
"-Wclippy::invalid_upcast_comparisons",
"-Wclippy::large_digit_groups",
"-Wclippy::large_stack_arrays",
"-Wclippy::large_types_passed_by_value",
"-Wclippy::let_unit_value",
"-Wclippy::linkedlist",
"-Wclippy::lossy_float_literal",
"-Wclippy::macro_use_imports",
"-Wclippy::manual_ok_or",
"-Wclippy::map_flatten",
"-Wclippy::mem_forget",
"-Wclippy::missing_enforced_import_renames",
"-Wclippy::mut_mut",
"-Wclippy::mutex_integer",
"-Wclippy::needless_borrow",
"-Wclippy::needless_collect",
"-Wclippy::needless_continue",
"-Wclippy::path_buf_push_overwrite",
"-Wclippy::rc_mutex",
"-Wclippy::redundant_clone",
"-Wclippy::redundant_closure_for_method_calls",
"-Wclippy::ref_option_ref",
"-Wclippy::rest_pat_in_fully_bound_structs",
"-Wclippy::same_functions_in_if_condition",
"-Wclippy::string_add",
"-Wclippy::string_add_assign",
"-Wclippy::todo",
"-Wclippy::trait_duplication_in_bounds",
"-Wclippy::trivially_copy_pass_by_ref",
"-Wclippy::uninlined_format_args",
"-Wclippy::unnested_or_patterns",
"-Wclippy::useless_transmute",
"-Wclippy::verbose_file_reads",
"-Wclippy::zero_sized_map_values",
"-Wfuture_incompatible",
"-Wnonstandard_style",
"-Wtrivial_numeric_casts",
"-Wunexpected_cfgs",
"-Wunused_lifetimes",
"-Wunused_qualifications",
"-Wclippy::unnecessary_wraps",
]

[target.wasm32-unknown-unknown]
rustflags = ['--cfg', 'getrandom_backend="unsupported"', '-C', 'target-feature=+simd128']
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#### Changes

- [BREAKING] Recursive MASM verification now accepts a claim commitment and authenticates the advice-supplied claim and kernel witness. Rust callers construct request-addressed inputs with `RecursiveVerifierInputs::for_request` ([#3447](https://github.com/0xMiden/miden-vm/pull/3447)).
- Adopted cargo-fixit, aligned clippy lints with crypto, cleared cargo-shear warnings ([#3479](https://github.com/0xMiden/miden-vm/pull/3479))

#### Fixes

Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ For example, a new change to the AIR crate might have the following message: `fe

- [Rustfmt](https://github.com/rust-lang/rustfmt) and [Clippy](https://github.com/rust-lang/rust-clippy) linting is included in CI pipeline. Anyways it's preferable to run linting locally before push:
```
cargo fix --allow-staged --allow-dirty --all-targets --all-features; cargo fmt; cargo clippy --workspace --all-targets --all-features -- -D warnings
cargo fixit --allow-staged --allow-dirty --all-targets --all-features; cargo fmt; cargo clippy --workspace --all-targets --all-features -- -D warnings
```

### Versioning
Expand Down
1 change: 0 additions & 1 deletion Cargo.lock

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

19 changes: 17 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,13 @@ FEATURES_verifier :=
# which runs `make clippy` with RUSTFLAGS=-D warnings (see .github/workflows/lint.yml).
DENY_WARNINGS := RUSTFLAGS="$(RUSTFLAGS) -D warnings"

# The clippy lint set is defined once, in the `xclippy` cargo alias in
# .cargo/config.toml, and extracted here so the check and fix paths cannot
# drift apart. cargo-fixit (a faster drop-in for `cargo clippy --fix`) cannot
# take lint flags as trailing arguments, so the fix path passes them via
# RUSTFLAGS instead.
CLIPPY_LINT_FLAGS := $(shell sed -n '/^xclippy = \[/,/^]/p' .cargo/config.toml | grep -oE '"-[WD][^"]+"' | tr -d '"' | tr '\n' ' ')

.PHONY: clippy
clippy: ## Runs Clippy with configs (alias for xclippy)
$(DENY_WARNINGS) cargo +stable xclippy
Expand All @@ -86,8 +93,16 @@ xclippy: ## Runs Clippy with custom lint config from .cargo/config.toml
fix: xclippy-fix format ## Applies automatic lint and format fixes

.PHONY: xclippy-fix
xclippy-fix: ## Runs Clippy with --fix using the same lints as xclippy
cargo +stable xclippy-fix
xclippy-fix: ## Applies clippy lint fixes via cargo-fixit (a faster `cargo clippy --fix`)
@if ! command -v cargo-fixit >/dev/null 2>&1; then \
echo "cargo-fixit is not installed; skipping clippy lint fixes." >&2; \
echo "It is a faster drop-in replacement for 'cargo clippy --fix'." >&2; \
echo "Install it with: cargo install cargo-fixit --locked" >&2; \
else \
RUSTFLAGS="$(CLIPPY_LINT_FLAGS)" cargo +stable fixit --clippy \
--allow-dirty --allow-staged \
--workspace --all-targets --all-features; \
fi


.PHONY: format
Expand Down
Empty file.
2 changes: 1 addition & 1 deletion air/src/proof_order.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ impl ProofOrder {
/// Decode a Lehmer rank into its AIR permutation.
fn from_rank(rank: usize) -> Self {
debug_assert!(rank < PROOF_ORDER_COUNT);
debug_assert!(rank <= u32::MAX as usize);
debug_assert!(u32::try_from(rank).is_ok());

let tag = rank as u32;
let mut rank = rank;
Expand Down
5 changes: 5 additions & 0 deletions core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,8 @@ rstest = { workspace = true }
serde_json = { workspace = true }
miden-utils-testing.workspace = true
trybuild.workspace = true

[package.metadata.cargo-shear]
# `tests/ui/` holds trybuild `compile_fail` fixtures loaded by path at runtime
# (see core/tests/public_api.rs), so static analysis cannot link them.
ignored-paths = ["tests/ui/**"]
2 changes: 1 addition & 1 deletion core/src/mast/serialization/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2096,7 +2096,7 @@ fn locate_single_block_indptr_and_digest_offsets(bytes: &[u8]) -> (usize, usize)
assert_eq!(discriminant, 3, "expected a Block node");

let payload = node_type_u64 & 0x0f_ff_ff_ff_ff_ff_ff_ff;
assert!(payload <= u32::MAX as u64, "Block ops_offset payload must fit in u32");
assert!(u32::try_from(payload).is_ok(), "Block ops_offset payload must fit in u32");
let ops_offset = payload as usize;

let digest_offset = view.node_hash_offset().unwrap();
Expand Down
2 changes: 1 addition & 1 deletion crates/ace-codegen/src/tests/basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ impl LiftedAir<F, EF> for TestAir {
_aux_inputs: &[F],
_challenges: &[EF],
) -> (RowMajorMatrix<EF>, Vec<EF>) {
unimplemented!("ACE codegen tests do not build concrete traces")
unreachable!("ACE codegen tests do not build concrete traces")
}

fn eval<AB: LiftedAirBuilder<F = F>>(&self, builder: &mut AB) {
Expand Down
3 changes: 1 addition & 2 deletions crates/assembly-syntax-cst/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,11 @@ doctest = false

[features]
default = ["std"]
std = ["miden-debug-types/std", "miden-utils-diagnostics/std", "rowan/std", "thiserror/std"]
std = ["miden-debug-types/std", "miden-utils-diagnostics/std", "rowan/std"]

[dependencies]
miden-debug-types.workspace = true
miden-utils-diagnostics.workspace = true
thiserror.workspace = true
rowan = { package = "miden-rowan", version = "0.16", default-features = false }

[dev-dependencies]
Expand Down
6 changes: 3 additions & 3 deletions crates/assembly-syntax/src/parser/value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -417,11 +417,11 @@ impl proptest::arbitrary::Arbitrary for IntValue {

#[inline]
pub(crate) fn shrink_u64_hex(n: u64) -> IntValue {
if n <= (u8::MAX as u64) {
if u8::try_from(n).is_ok() {
IntValue::U8(n as u8)
} else if n <= (u16::MAX as u64) {
} else if u16::try_from(n).is_ok() {
IntValue::U16(n as u16)
} else if n <= (u32::MAX as u64) {
} else if u32::try_from(n).is_ok() {
IntValue::U32(n as u32)
} else {
IntValue::Felt(Felt::new_unchecked(n))
Expand Down
12 changes: 1 addition & 11 deletions crates/debug-types/src/span.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ impl<T: ?Sized + Spanned> Spanned for alloc::sync::Arc<T> {

/// This type is used to wrap any `T` with a [SourceSpan], and is typically used when it is not
/// convenient to add a [SourceSpan] to the type - most commonly because we don't control the type.
#[derive(Clone, Copy)]
pub struct Span<T> {
span: SourceSpan,
spanned: T,
Expand Down Expand Up @@ -94,17 +95,6 @@ impl<T> Spanned for Span<T> {
}
}

impl<T: Copy> Copy for Span<T> {}

impl<T: Clone> Clone for Span<T> {
fn clone(&self) -> Self {
Self {
span: self.span,
spanned: self.spanned.clone(),
}
}
}

impl<T: Default> Default for Span<T> {
fn default() -> Self {
Self {
Expand Down
3 changes: 1 addition & 2 deletions crates/lib/core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ std = [
"miden-utils-sync/std",
]
testing = ["arbitrary"]
constraints-tools = ["std", "dep:miden-air", "dep:miden-ace-codegen", "dep:miden-constraint-compiler"]
constraints-tools = ["std", "dep:miden-air", "dep:miden-constraint-compiler"]

[dependencies]
# Miden dependencies
Expand All @@ -46,7 +46,6 @@ miden-precompiles.workspace = true
miden-processor.workspace = true
miden-utils-sync.workspace = true
miden-air = { workspace = true, optional = true }
miden-ace-codegen = { workspace = true, optional = true }
miden-constraint-compiler = { workspace = true, optional = true }

# External dependencies
Expand Down
8 changes: 8 additions & 0 deletions crates/lib/core/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,14 @@ fn local_procedure_docs(module: &Module) -> Vec<(String, Option<String>)> {
procedures
}

/// Resolve the documentation for a re-exported item.
///
/// The outer `Option` distinguishes "target procedure not found" (skip the
/// re-export entirely) from "found", and the inner `Option` carries the docs
/// (`None` when the target has no doc comment). Encoding these three states
/// without nesting would require a bespoke enum, so we allow `option_option`
/// here deliberately.
#[allow(clippy::option_option)]
fn reexport_target_docs(
import: &ast::ItemImport,
current_module_path: &miden_assembly_syntax::Path,
Expand Down
Loading
Loading