Skip to content

chore: format this branch's code, fix its clippy errors and pin the Lint toolchain - #6

Draft
TechArtistG wants to merge 8 commits into
feature/v0.8.14-stress-fixesfrom
chore/lint-stress-fixes
Draft

TechArtistG wants to merge 8 commits into
feature/v0.8.14-stress-fixesfrom
chore/lint-stress-fixes

Conversation

@TechArtistG

Copy link
Copy Markdown
Collaborator

What changes

pre-commit fails on every pull request into feature/v0.8.14-stress-fixes, for reasons that are in the branch and not in the pull requests. This PR makes the Lint job pass at the base, so that it shows what a pull request adds.

  • Formatting. The code this branch added on top of upstream was never run through rustfmt. One commit formats it: 25 files, formatting only.
  • Clippy, this branch's code. 52 clippy errors in code this branch added are fixed in six commits. No behaviour changes. Four places get a scoped #[allow], each with its reason in a comment.
  • Clippy, the toolchain. lint.yml used whichever stable Rust the runner had. Stable 1.100 reports 157 more errors, all in upstream code that this branch does not modify. Upstream fixed those later in cd28d446, which does not apply to this branch. The last commit pins clippy to 1.97.1 and rustfmt to nightly-2026-11-22. Drop that commit when this branch takes the upstream fix.

Not changed

  • No upstream line changes content, except one .into() that a change on this branch had made redundant.
  • Two upstream blocks move without changing: impl Drop for FSLock goes above its test module, and the doc comment and #[allow] of stage_filesystem_path go back onto that function.
  • The Lint job still does not build the vfs feature. That code was linted by hand for this PR.

Tests

On Linux:

  • cargo +nightly-2026-11-22 fmt --all --check passes.
  • pre-commit run --all-files with Rust 1.97.1 as the default toolchain passes. That is the Lint job's command.
  • cargo +1.97.1 clippy --all-targets --features vfs -p lore-revision -p lore -p lore-client -- -D warnings --no-deps passes.
  • These tests pass: the library tests of lore-base, lore-transport, lore-credential, lore-storage, lore-server, lore-revision and lore; lore-server --test client_renewal; lore-revision --test cross_vcs; and with --features vfs, the library tests of lore-revision and lore and lore-revision --test vfs_fuse.

Not run: Windows and macOS builds, and the other integration test targets. The pinned Lint workflow runs for the first time on this pull request.

The Lint workflow formats with the latest nightly rustfmt, and
cargo +nightly fmt --all --check fails on every pull request against this
branch before reaching anything the pull request changes: 117 hunks in 25
files, all in code this branch added on top of upstream 826ad5d, which
itself formats clean.

This is the output of cargo +nightly fmt --all with rustfmt 1.12.0-nightly
(bdf712ee87 2026-11-21), the version the failing runs used. Formatting only.

Signed-off-by: Geordie Moffatt <geordie.moffatt@generalrobotics.company>
…for clippy

clippy -D warnings rejects these in code this branch added on top of
upstream; each change is the rewrite clippy suggests and leaves behaviour as
it was:

- doc_markdown: put the identifiers named in doc comments (environment
  variables, RPC names, ProjFS) in backticks. Comments only.
- map_err_ignore: the closures that drop an error now bind it to a named
  `_` binding (`_elapsed`, `_refused`, `_unavailable`) instead of `_`. The
  value is still discarded exactly as before.
- map_unwrap_or: `.map(f).unwrap_or(a)` becomes `.map_or(a, f)` and
  `.map(f).unwrap_or(false)` becomes `.is_ok_and(f)`. The defaults are
  constants, so evaluating them eagerly changes nothing.

Signed-off-by: Geordie Moffatt <geordie.moffatt@generalrobotics.company>
Each of these is the rewrite clippy proposes for code this branch added,
and none changes what the code does:

- items_after_test_module (lore-base fs/lock.rs): `impl Drop for FSLock`
  moves above the test module. Item order has no meaning in Rust.
- single_match_else (lore-revision repository.rs, lore-server
  authnz/grants.rs): a two-arm match on an Option becomes if let/else with
  the same arms in the same order.
- collapsible_if (lore-server auth/jwk.rs): the nested `if let ... { if ...`
  becomes one let chain; the read guard is still taken only when a key is
  wanted, and the branch still only returns.
- useless_conversion (lore-server repository_metadata_set.rs): drops an
  `.into()` from `Partition` to `Partition`.
- unused_self (lore-server stream_authorization_tests.rs): the test
  helper `put_request` reads nothing from `self`, so it becomes an
  associated function.
- semicolon_if_nothing_returned (lore-server tests/client_renewal.rs),
  byte_char_slices (lore-storage fan_out.rs test: `*b"LVN"` is the same
  three bytes) and unnested_or_patterns (lore-transport grpc/mod.rs:
  `Ok("1" | "true" | "TRUE")` matches the same values).
- unused_async (lore/src/repository.rs): the `mount_impl` built without
  the `vfs` feature does not await, but it has to stay `async` like the
  two `vfs` versions because `mount` awaits whichever one is built. It
  gets a scoped `#[allow(clippy::unused_async)]` saying so.

Signed-off-by: Geordie Moffatt <geordie.moffatt@generalrobotics.company>
clippy's disallowed_methods rejects four direct spawns and two direct
`std::fs::write` calls in code this branch added.

- lore-storage tests (local/flush.rs, local/immutable_store.rs,
  local/mutable_store.rs, packstore.rs) spawn with `lore_base::lore_spawn!`
  instead of `tokio::spawn` / `JoinSet::spawn`, as the workspace
  clippy.toml asks. Inside a runtime, `lore_spawn!` spawns on
  `Handle::try_current()`, which is the test's own runtime. The tests set
  no `LORE_CONTEXT`, so nothing is scoped, and `ObservedTask` does nothing
  without a lifecycle callback. The tasks therefore run where and as they
  did before.
- lore-revision `write_mount_binding` writes the mount-binding file in
  `.lore`. lore-revision's clippy.toml asks for a
  `RepositoryWriteToken`-gated helper, or an `allow` on an authorized
  writer. Gating it would change the signature of a pub function the
  `lore` crate calls, so it gets the scoped `allow` with a reason, as the
  repository ID writer in the same file already does.
- lore-revision tests/cross_vcs.rs writes a `.loreignore` fixture before
  any repository exists; the statement gets a scoped `allow` with a reason.

Signed-off-by: Geordie Moffatt <geordie.moffatt@generalrobotics.company>
clippy's large_futures flags the startup-refusal tests in lore-server's
server.rs: `start` wraps `async_main` (about 11 KB) in a timeout, so
`start` and each test that awaits it hold an 11 KB future on the stack.
Pinning `async_main` in a Box at that one call site, as clippy suggests,
moves it to the heap and clears all five reports. The same future runs
under the same 30 s timeout; only where its state lives changes. Test code
only.

Signed-off-by: Geordie Moffatt <geordie.moffatt@generalrobotics.company>
clippy's too_many_arguments flags two functions:

- lore-revision stage.rs `stage_filesystem_path` (10 arguments). Upstream
  carries `#[allow(clippy::too_many_arguments)]` and its doc comment on
  this function. When this branch added `ensure_not_git_tracked` (fcca0ec),
  it was inserted between them and the function, so they ended up on the
  new helper. This moves the four upstream lines back to the function they
  belong to, as upstream has them. No code changes.
- lore-server grpc/server.rs `GrpcServerBuilder::with_http2_config` grew a
  seventh setting (`build_guard`) on this branch, making 8 with `self`. It
  is public and called positionally from lore-server, its tests and
  lore-integration-tests, so a parameter struct would change its
  signature. It gets the same scoped allow, with a comment saying why.

Signed-off-by: Geordie Moffatt <geordie.moffatt@generalrobotics.company>
clippy's doc_markdown flags `ProjFS` in the doc comment of
`staged_delete_paths` in lore-revision/src/vfs/core.rs. The module is only
built with the `vfs` feature, which the Lint workflow's clippy run (default
features) never enables, so this showed up only under
`cargo clippy --features vfs`. Comment only.

Signed-off-by: Geordie Moffatt <geordie.moffatt@generalrobotics.company>
…026-11-22

Lint installs the latest nightly for rustfmt and uses whatever stable the
runner has for clippy. On 2026-11-22 that was clippy 1.100.0, which fails
157 places in upstream code this branch never changed (empty_enums on
zerocopy derive output, map(..).unwrap_or_default(), result_large_err, ...).
Upstream fixed these on main in cd28d44, which does not apply to this
branch. With these pins, Lint checks every pull request against the same
toolchains this branch is clean on:

- clippy and cargo-deny run on 1.97.1, set as the default toolchain the
  pre-commit hooks' plain `cargo` resolves to.
- cargo-fmt runs on nightly-2026-11-22 (rustfmt bdf712ee87), named in the
  hook entry so a local `pre-commit run` formats the same way.

Drop this commit when the branch moves to an upstream that has
cd28d44, or once the remaining 1.100 lints are fixed.

Signed-off-by: Geordie Moffatt <geordie.moffatt@generalrobotics.company>
@TechArtistG
TechArtistG added this pull request to stack #7 December 2, 2026 20:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant