Repository navigation
Chore
-
enable many new workspace clippy lints and fix all resulting warnings
Enables a large batch of new clippy lints in[workspace.lints.clippy]
and fixes every resulting warning — the workspace is now clean under
cargo clippy --workspace --all-targets.Lint config changes (
Cargo.toml)Round 1 — initial batch:
collapsible_else_if,doc_markdown,
format_collect,ignore_without_reason,ignored_unit_patterns,
inconsistent_struct_constructor,manual_assert,manual_string_new,
match_bool,mismatching_type_param_order,mut_mut,
nonminimal_bool,option_as_ref_cloned,ptr_cast_constness,
pub_underscore_fields,ref_binding_to_reference,ref_option,
ref_option_ref,single_char_pattern,str_split_at_newline,
string_add_assign,transmute_ptr_to_ptr,type_repetition_in_boundsRound 2 — added after auditing hit counts across the workspace:
- Zero-hit future-guards:
borrow_as_ptr,doc_link_with_quotes,
expl_impl_clone_on_copy,inefficient_to_string,macro_use_imports,
range_minus_one,rest_pat_in_fully_bound_structs,
string_to_string,trait_duplication_in_bounds,unnecessary_join - Low-noise with fixes:
bool_to_int_with_if,cast_lossless,
equatable_if_let,needless_raw_string_hashes,redundant_else,
string_add,unnested_or_patterns,unused_peekable
Removed / deferred:
many_single_char_names— removed; only fired on idiomatic
single-letter names in bench/test code (effectively all false positives)must_use_candidate— tried it, then removed: it demands annotations
stricter than std itself (std doesn't markVec::iter()etc.), and its
heuristic misfired on dataflow-builder functions whose side effects are
the point. Kept a curated set of 19#[must_use]s on consuming
builder setters (RustCrate::pin_to_core,TrybuildHost::tracing,
MaelstromDeploy::node_count/rate/time_limit,SimFlowoptions,
theNetworkingConfigtransport/reliability chain, …) where dropping
the return value silently discards configuration.manual_assert_eq— commented out as TODO; requires clippy 1.97.0dbg_macro,undocumented_unsafe_blocks— commented out as TODOs for
follow-up
Warning fixes (~350 warnings)
Auto-fixed via
cargo clippy --fix(all reviewed):doc_markdown
backticks/<URL>s,_→()for unit patterns,if cond { panic!() }
→assert!(), char patterns,usize::from(..)instead ofascasts /
bool-to-intifs,matches!(), nested or-patterns, redundantelse
removal, etc.dfir_lang codegen fixes — the most interesting finding: ~270
warnings pointed at user call sites ofsource_stream,
difference/anti_join,null, andsource_stream_serde, but the
offending patterns were in dfir_lang's generated code (which carries
call-site spans). Fixed at the source so downstream users with these
lints enabled won't see them either:source_stream:PullStep::Ready(_, _)→PullStep::Ready(..)anti_join/difference:|(k, _)|→|(k, _v)|(the_matched
()values)null: allowignored_unit_patternson the generatedlet _ = (...)source_stream_serde: nested the generatedPoll::Ready(Some(Err(_))) | Poll::Ready(None)or-pattern
Manual cleanups on top of the auto-fixes:
- Rewrote De Morgan-ugly generated asserts (
assert!(!(!a && !b))) into
readable positive forms orif+assert!(FlowBuilder/handle drop
guards, multiversioned network sends, recompilation checks, sim
deterministic-hook checks) - Fixed doc comments the autofix mangled (
merge_modulesexample is now
a```textblock;GhtInner<GhtInner<GhtLeaf<...>>>;
Rc<RefCell<Vec<T>>>) plus nearby typos and formatting not caught by
the lint type_repetition_in_bounds: merged duplicate where-clause predicates
in lattices GHT and hydro_lang stream/keyed_singleton/networkingignore_without_reason: maelstrom tests nowignore = "requires the Maelstrom binary (set the MAELSTROM_PATH env var)"unused_peekablecaught a genuinely unused.peekable()in
hydro_langir/backtrace.rsstring_add:format!()/push('\n')rewrites (verified the
q!-quoted maelstrom body isn't embedded in any snapshots)String::new()in the no_stdlatticestest neededuse alloc::string::String
Verification
cargo clippy --workspace --all-targets— zero warningscargo +nightly fmt --all— clean- Test suites pass:
lattices,dfir_lang,dfir_pipes, anddfir_rs
(309 tests incl. compile-fail/trybuild and graphviz/mermaid snapshots)
- Zero-hit future-guards:
Refactor
-
replace snapshot-only ticks with non-lazy inputs
[ci-bench]Prepares for lazy snapshot ingress (#3270), under which a tick whose
only inputs are snapshots
/ state (no batched-in stream) can never fire. Rewrites the
snapshot-only ticks in hydro_lang and
hydro_test so each tick is driven by a batched (non-lazy) input:Stream::timeout: instead of snapshotting a fold ofInstant::now()
into a fresh tick, every
batch of inputs arms a countdown (tokio::time::sleep(duration)
resolved at the top level),
tagged with a fresh epoch. Asliced!region batches the inputs and the
expired countdowns and
keeps the current epoch as state: a countdown whose epoch is still
current (no newer input) is
a timeout; stale countdowns are ignored; the next input clears it. No
Instantreads in the
tick. The countdown feedback into the slice is broken by a top-level
defer_tick(added in
the preceding revision).durationis now quoted in the top-level
operator context, and
L::DropConsistency: TopLevelis required.map_reduce: the leader batches the partial counts into its tick and
usesacross_ticks
(atomicreduce+ snapshot back into the same tick) instead of
snapshotting a top-level
reduceinto a fresh tick.echo_server: the connection-count log batches a 1-second
source_intervalinto the slice
that snapshots the membership, instead of a snapshot-only slice followed
bysample_every.
Remaining snapshot-only ticks, still to do:
bench_client's
virtual-client spawner
(new_payload_ids) andpaxos_bench's checkpoint quorum.hydro_test IR snapshots updated (map_reduce, paxos). hydro_test: all
tests pass.
Bug Fixes (BREAKING)
-
type
source_intervalAtLeastOnce, read the clock throughuse::time, and replace falsemanual_proof!commutativity claims withassume_ordering
Rust-side changes that fell out of the Lean formalization of Hydro
(hydro_lean/, a separate PR stacked on this one). Each item is a place
where the types or amanual_proof!claimed something the program does
not guarantee; the fix is to state the real nondeterminism with
nondet!so it is visible to the type system and the simulator.source_intervalisAtLeastOncesource_interval/source_interval_delayed
(hydro_lang/src/location/mod.rs) now returnStream<(), _, Unbounded, TotalOrder, AtLeastOnce>. A timer's fires can repeat, andExactlyOnce
hid that from the types. Consumers that genuinely needExactlyOncesay
so withassume_retriesand anondet!reason.sample_every's interval hook is typedBatchHook<(), TotalOrder, AtLeastOnce, _>accordingly (singleton.rs,stream/mod.rs).raftkeeps takingExactlyOncetimer streams (its sim tests feed
them fromsim_input); the deployment wirings
(hydro_test/examples/raft.rs, theraft_irsnapshot'screate_raft)
apply.assume_retries::<ExactlyOnce>(nondet!(…))to
source_interval's streams — a repeated fire is just another fire.- The simulator does not support batching an
AtLeastOncestream (its
existingtodo!), sosource_intervalstays unsupported in sim — as
before, now visibly.
Clock reads go through
use::time- New
use::time(nondet!(…))sliced!style over
Tick::current_tick_instant(sliced/style.rs). Stream::timeoutis rewritten over it: the latest-arrival register is
stamped with the tick's clock reading, instead of anInstant::now()
inside a fold closure.hydro_std::bench_client:Instant::now()reads inside afold
closure and amapwere wall-clock reads invisible to the types;
replaced byuse::time. The overwrite-reduce'scommutative = manual_proof!becomesassume_ordering::<TotalOrder>(nondet!(/** one in flight per virtual client */)). The clock-reading functions are gated
on thetokiofeature.
The Paxos recommit fold is not commutative
Commit Statistics
- 3 commits contributed to the release.
- 51 days passed between releases.
- 3 commits were understood as conventional.
- 3 unique issues were worked on: #3204, #3278, #3353
Commit Details
view details
- #3204
- Enable many new workspace clippy lints and fix all resulting warnings (aca1170)
- #3278
- Replace snapshot-only ticks with non-lazy inputs (3f8b82e)
- #3353
- Type
source_intervalAtLeastOnce, read the clock throughuse::time, and replace falsemanual_proof!commutativity claims withassume_ordering(cbd1438)
- Type